Skip to content

Instantly share code, notes, and snippets.

@tekk555
tekk555 / gist:6204356
Last active December 20, 2015 22:19
インメモリファイルシステムの作成.Ubuntu 12.04 LTS
mount -t tmpfs -o size=64m tmpfs /dev/shm
mount -t tmpfs -o size=64m /dev/shm /var/tmp
# root user
@tekk555
tekk555 / gist:6204794
Last active December 20, 2015 22:28
ランダムソート.Ubuntu 12.04 LTS
sort -R list.txt
@tekk555
tekk555 / gist:6204822
Last active December 20, 2015 22:28
find でファイルのみ対象.Ubuntu 12.04 LTS
find /var/tmp -type f
@tekk555
tekk555 / gist:6204826
Last active December 20, 2015 22:28
find で ファイルごとにコマンドを実行する.Ubuntu 12.04 LTS
find /var/tmp -type f -exec ls -i {} \;
@tekk555
tekk555 / gist:6204835
Last active December 20, 2015 22:28
任意のサイズのランダムなバイナリファイルを作成する.Ubuntu 12.04LTS
# 100 byte
dd if=/dev/urandom of=/var/100byte.dat count=100 bs=1;
# 150 kbyte
dd if=/dev/urandom of=/var/150kbyte.dat count=150 bs=1k;
@tekk555
tekk555 / gist:6204862
Last active December 20, 2015 22:28
shell で for loop. ubuntu 12.04LTS
#!/bin/sh
for i in `seq 1 25`; do
dd if=/dev/urandom of=/var/temp/$i.dat count=180 bs=1k;
done;
@tekk555
tekk555 / gist:6204944
Created August 11, 2013 13:37
Shutdown Ubuntu 12.04
shutdown -r now
shutdown -h now
# root user
@tekk555
tekk555 / gist:6204994
Created August 11, 2013 13:52
ナノ秒精度での計測:java
long t1 = System.nanoTime();
long t2 = System.nanoTime();
System.out.println(t2-t1);
@tekk555
tekk555 / gist:6205213
Created August 11, 2013 14:48
ディスクのキャッシュをクリアする(但し、実際にはクリアされているという実感が無い)Ubuntu 12.04LTS
sync
sysctl -w vm.drop_caches=1
sysctl -w vm.drop_caches=2
sysctl -w vm.drop_caches=3
hdparm -f /dev/vda
@tekk555
tekk555 / gist:6205438
Created August 11, 2013 15:51
Sqlite3のBLOBインサートSQL
CREATE TABLE TEST(
DATA_ID INTEGER,
DATA_AREA BLOB,
CONSTRAINT TEST_PKEY PRIMARY KEY (DATA_ID)
);
echo "insert into test(DATA_ID, DATA_AREA) values(1,x'"$(hexdump -v -e '1/1 "%02x"' bin.dat)"');"