This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (int) hls_param_get:(NSDictionary*) param key:(NSString*)key min_max:(int) min_max | |
| { | |
| NSArray *a = [param objectForKey:key]; | |
| NSNumber *nsnumber = (NSNumber*)a[min_max]; | |
| NSInteger value = [nsnumber integerValue]; | |
| return (int)value; | |
| } | |
| NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys: | |
| @[@0,@15], @"HRange", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cut -f1,8 aaa | ruby -na -e 'require "pp";BEGIN{h={}}; h[$F[0]] ||= [];h[$F[0]] << $F[1]; END{pp h}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| find * | xargs -n1 {command} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'nkf' | |
| string = NKF::nkf( '-WwZ0', string ) #全角記号を半角に変換しておく | |
| string.gsub!(/[\s\!\"\#\$\%\&\'\(\)\-\=\^\~\\\|\@\`\[\]\{\}\;\:\+\*\<\>\,\.\/\?\_]/,"") #とりあえず全部エスケープしたがわけがわからん。。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #差出人が自分の場合はSubjectにマークを付ける。 | |
| myaddress=`pwd | cut -d/ -f5` #自分のメールアドレス | |
| if ( /^From:\s*(.*)${myaddress}@example.com/) | |
| { | |
| mark=`echo '[送信メール]' | nkf -jM` | |
| xfilter "sed -e 's|^Subject: |Subject: $mark |' " | |
| } | |
| cc "[email protected]" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #差出人が自分の場合は送信済みフォルダにメールを移動する | |
| myaddress=`pwd | cut -d/ -f5` #自分のメールアドレス | |
| if ( /^From:\s*(.*)${myaddress}@example.com/) #この例では自ドメインはexample.comとする | |
| { | |
| to "maildir/.Sent/" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| if [ $$ -ne $(pgrep -fo "$0") ]; then | |
| echo "実行中。2重起動を禁止しています。" | |
| exit 1 | |
| fi | |
| trap 'kill $(jobs -p);echo 強制終了されました。' EXIT | |
| #処理本体 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| SCRIPT_DIR=$(cd $(dirname $0);pwd) #スクリプトのフルパス | |
| LOCK_FILE="$SCRIPT_DIR/lock.pid" | |
| if [ -e $LOCK_FILE ]; then | |
| #ロックファイルが存在する場合は何もしない | |
| echo "実行中。2重起動を禁止しています。" | |
| else | |
| #ロックファイルがあれば作って処理を起動 | |
| echo $$ > $LOCK_FILE #とりあえずプロセスIDを書き込んでおく |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| curl $1 | ruby | |
| # How to use | |
| # $ ./git-exec-ruby.sh https://gist.githubusercontent.com/koki-h/9e004e2d683ec31fe00a/raw/2da2caf0b1ed6b69b0f396a2ee0389882ebb4841/sample.rb | |
| #こういうの↓を実行するとき便利 | |
| # https://github.com/mame/trance-book |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- encoding: utf-8 -*- | |
| # Original code is http://aws.typepad.com/jp_mws/2012/12/amazon-mws-ruby-sample.html | |
| require 'uri' | |
| require 'time' | |
| require 'openssl' | |
| require 'base64' | |
| require "net/https" | |
| require "pp" | |
| require 'active_support' |