/var/log/seiji

06 Nov 2012

ios-utf8mb4-substring

Use this function incase of including utf8mb4(emoji)

1
2
3
4
5
6
- (void)enumerateSubstringsInRange:(NSRange)range
                           options:(NSStringEnumerationOptions)opts
                        usingBlock:(void (^)(NSString *substring,
                                             NSRange substringRange,
                                             NSRange enclosingRange,
                                             BOOL *stop))block

18 Oct 2012

rubymotion can't open simulator in tmux.

Solution

1
2
$ brew install reattach-to-user-namespace 
$ echo 'set-option -g default-command "reattach-to-user-namespace -l $SHELL"' >> ~/.tmux.conf"

in case that warning: unsupported new OS, trying as if it were 10.6-10.7

1
2
$ brew update
$ brew upgrade reattach-to-user-namespace

or

1
2
3
4
5
$ brew edit reattach-to-user-namespace
# dadea0aa48259c704d0b412b9588de2f5623e323 (on line 6) to ece1935953593d05e98d8c3ee8f956b2429d633f
# dadea0 (on line 7) to ece193

$ brew upgrade reattach-to-user-namespace

01 Aug 2012

issue commands using parallel distributed shell (pdsh)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Install
$ brew install pdsh
// Setting
$ mkdir -p ~/.dsh/group
$ cat ~/.dsh/group/vps
linode
linode2
// Issue command
$ pdsh -g vps df -h | dshbak -c
----------------
linode
----------------
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda              20G  9.8G  9.6G  51% /
tmpfs                 243M  124K  243M   1% /dev/shm
----------------
linode2
----------------
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda              20G  5.1G   15G  27% /
tmpfs                 243M  124K  243M   1% /dev/shm

31 Jul 2012

TED subtitle using command line

1
curl http://www.ted.com/talks/subtitles/id/$ID/lang/en | jsawk "return this.captions" | jsawk "return this.content" | jsawk -a 'return this.join(" ")'