Skip to content

Instantly share code, notes, and snippets.

  • redis-cli -A secret get foo
19:27:55.413331:[S] ""
19:27:55.413375:[SA] ""
19:27:55.416550:[A] "......"
19:27:55.422557:[PA] "*2\r\n$4\r\nAUTH\r\n$6\r\nsecret\r\n"
19:27:55.422589:[A] ""
19:27:55.422641:[PA] "+OK\r\n"
19:27:55.428735:[PA] "*2\r\n$3\r\nget\r\n$3\r\nfoo\r\n"
19:27:55.428810:[PA] "-MOVED 12182 127.0.0.1:7001\r\n"
@maiha
maiha / packet.md
Last active September 21, 2016 16:56
EtherHeader(MacHeader): 14bytes
IpHeader: 20bytes
TcpHeader: 20bytes
@maiha
maiha / docker.md
Last active May 24, 2020 09:35
Cheatsheet : Install Applications
% gdb ./app core -ex bt
(snip)
[New LWP 27887]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./app'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000000000000000 in ?? ()
#0 0x0000000000000000 in ?? ()
#1 0x00007fd8fe361a33 in __GI__dl_addr (
@maiha
maiha / select with timeout.cr
Created July 19, 2016 06:28
Crystal lang tips
# https://github.com/crystal-lang/crystal/issues/2990#issuecomment-232775971
spawn do
sleep 10
ch.close
end
spawn do
sleep 20
ch.send 1 # => Exception
@maiha
maiha / redis-cluster-testing.sh
Created June 15, 2016 08:06
Study for redis-cluster on docker
# redis cluster ports
alias rc='for x in `seq 7001 7003`'
# create template
cat > redis.conf
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
^D
@maiha
maiha / 0_result.txt
Last active June 14, 2016 12:01
crystal benchmark to create string
% crystal build --release bench.cr
% ./bench
"127.0.0.1"
"127.0.0.1"
"127.0.0.1"
"127.0.0.1"
"127.0.0.1"
"127:0:0:1"
"127:0:0:1"
@maiha
maiha / redis-replication.txt
Created May 17, 2016 12:58
redis replication
http://hackerslab.aktsk.jp/other/redis_cluster_construction_method/
http://www.walksocket.com/archives/343
http://tech.kayac.com/archive/reconnect_redisfast.html
http://qiita.com/uryyyyyyy/items/fc767f7f41144e5f10a1
http://kakakikikeke.blogspot.jp/2015/08/add-node-redis-cluster.html
% supervisorctl status
kafka-manager RUNNING pid 17563, uptime 23:59:24
kafka08-1 RUNNING pid 62016, uptime 0:40:45
kafka08-2 STOPPED Jan 27 09:35 AM
kafka08-3 STOPPED Jan 27 09:35 AM
kafka08-4 RUNNING pid 27164, uptime 3:20:28
kafka08-5 STOPPED Not started
kafka09-1 STOPPED Jan 27 05:14 PM
kafka09-2 RUNNING pid 45687, uptime 8:18:28
kafka09-3 RUNNING pid 45760, uptime 8:18:07
@maiha
maiha / crystal.md
Last active December 25, 2015 17:31

compile error

cannot find -lpcre

  • in ubuntu
./bin/crystal build  -o .build/all_spec spec/all_spec.cr
Using compiled compiler at .build/crystal
/usr/bin/ld: cannot find -lpcre