Skip to content

Instantly share code, notes, and snippets.

@ikeisuke
ikeisuke / client
Last active June 18, 2021 06:02
golangで書くunix domain socketを使ったserver/clientのサンプルコード ref: http://qiita.com/ikeisuke/items/f5eccc178ed388aac92f
$ go run client.go /tmp/uds-sample-server.sock 0123456789abcdefghijklmnopqrstuvwxyz
# サーバーへの送信データ
client.go:28: send: 0123456789abcdefghijklmnopqrstuvwxyz
# サーバーからの受信データ
client.go:44: receive: 0123456789
client.go:44: receive: abcdefghij
client.go:44: receive: klmnopqrst
client.go:44: receive: uvwxyz0123
client.go:44: receive: 456789abcd
client.go:44: receive: efghijklmn
@ikeisuke
ikeisuke / file0.txt
Last active October 14, 2016 05:35
serverlessでデプロイパッケージからディレクトリごとをexcludeする ref: http://qiita.com/ikeisuke/items/861b6351b17947cfe358
$ uname -a
Darwin xxxxxx 15.6.0 Darwin Kernel Version 15.6.0: Mon Aug 29 20:21:34 PDT 2016; root:xnu-3248.60.11~1/RELEASE_X86_64 x86_64
$ node -v
v6.7.0
$ serverless -v
1.0.2
$ cat /usr/local/lib/node_modules/serverless/node_modules/glob/package.json | grep '"version"'
"version": "7.1.0"
@ikeisuke
ikeisuke / file0.txt
Last active August 19, 2016 05:56
bashのファイルのタイムスタンプ比較処理がよくわからなかったので調べてみた ref: http://qiita.com/ikeisuke/items/2cc48db12baeab932450
[ $A -nt $B]:
1: $A and $B do not exist ($A=, $B=)
0: $A exists, $B does not exist ($A=2016-08-19 14:43:18.214264727 +0900, $B=)
1: $A dose not exist. $B exists ($A=, $B=2016-08-19 14:43:18.214264727 +0900)
1: $A is older than $B ($A=2016-08-19 14:43:18.218264799 +0900, $B=2016-08-19 14:43:19.218282884 +0900)
1: $A is older than $B(0.1sec) ($A=2016-08-19 14:43:19.222282957 +0900, $B=2016-08-19 14:43:19.322284769 +0900)
0: $A is newer than $B ($A=2016-08-19 14:43:20.326302931 +0900, $B=2016-08-19 14:43:19.326284841 +0900)
1: $A is newer than $B(0.1sec) ($A=2016-08-19 14:43:20.434304881 +0900, $B=2016-08-19 14:43:20.330303003 +0900)
1: $A and $B is same timestamp ($A=2016-08-19 14:43:20.434304881 +0900, $B=2016-08-19 14:43:20.434304881 +0900)
[ $A -ot $B]:
@ikeisuke
ikeisuke / extensions.swift
Created January 11, 2015 13:28
swiftでS3のマルチパートアップロード時のETagを計算する ref: http://qiita.com/ikeisuke/items/8222899dd0742112680d
extension NSData {
func s3etag(minimumPartSize: UInt64 = 5 * 1024 * 1024) -> String {
func md5digest(data: NSData) -> NSData {
let digestLength = Int(CC_MD5_DIGEST_LENGTH)
let md5Buffer = UnsafeMutablePointer<CUnsignedChar>.alloc(digestLength)
CC_MD5(data.bytes, CC_LONG(data.length), md5Buffer)
return NSMutableData(bytesNoCopy: md5Buffer, length: digestLength)
}
func md5hexdigext(data: NSData) -> String {
@ikeisuke
ikeisuke / file0.txt
Created June 16, 2014 01:00
rubyで動画ファイルを作成日のディレクトリに移動する ref: http://qiita.com/ikeisuke/items/aafd96e69c2c5feb23d8
% brew install ffmpeg