Skip to content

Instantly share code, notes, and snippets.

@nari-ex
nari-ex / get_header_and_status.sh
Last active August 29, 2015 14:10
get https header and status by curl
$ time curl -I -w '%{http_code}\n' http://192.0.2.3/index.php
@nari-ex
nari-ex / rename.py
Created February 9, 2015 12:56
大量のファイルを移動するスクリプト
#!/usr/bin/env python
# coding: utf-8
import os
import time
src_dir = ""
dst_dir = ""
import_file = ""
export_file = ""
#/bin/bash
set -euo pipefail
filepath=$1
# 10MBytes/sec
filesize=$(du -m ${filepath} | awk '{print $1}')
sleep_time=0.1
for num in $(seq 1 ${filesize});
find ./ -exec sleep 0.1 \; -delete -print
find . -print -exec sleep 0.1 \; | xargs -n1 -I%% mv %% dst_dir/
# rsync コマンドを用いるケース
rsync -av --bwlimit 10000 src dst
# tar + pv コマンドを用いるケース
tar czvf - src | pv -L 2048k | cat - > /path/to/dist
# dd で全部やるパターン
ionice -c3 dd if=/dev/zero of=100GB.img bs=1M count=102400 oflag=direct
ionice -c3 dd if=/dev/zero of=100GB.img bs=1M count=102400 oflag=sync
ionice -c3 dd if=/dev/zero of=100GB.img bs=1M count=102400 oflag=fdatasync
ionice -c3 dd if=/dev/zero of=100GB.img bs=1M count=102400 oflag=fsync
# 単位ファイルを作成して足し続けるパターン
ionice -c3 dd if=/dev/zero of=100MB.img bs=1M count=100 oflag=direct
for i in $(seq 1 1000); do ionice -c3 cat 100MB.img >> 100GB.img; sleep 5; done
@nari-ex
nari-ex / rice_brand.json
Last active August 29, 2015 14:21
rice_brand
{
"brand": [
"夢ごこち",
"彩",
"初星",
"四国",
"春陽",
"朝日",
"秋晴",
"でわ75ひかり",
@nari-ex
nari-ex / install_mariadb10.0_and_maxscale1.2.txt
Last active October 21, 2015 04:07
Install mariadb v10.0 and maxscale v1.2
# yum install https://downloads.mariadb.com/enterprise/WY99-BC52/generate/10.0/mariadb-maxscale=1.2/mariadb-enterprise-repository.rpm
# yum install MariaDB-server MariaDB-client
# yum install maxscale
@nari-ex
nari-ex / build_jwhois.sh
Last active December 30, 2015 22:19
jwhois build
cd /usr/local/src/
wget http://ftp.de.debian.org/debian/pool/main/j/jwhois/jwhois_4.0.orig.tar.gz
tar xzvf jwhois_4.0.orig.tar.gz
cd jwhois-4.0/
wget http://www.fukatani.org/~hi-lo/blog/archives/upload_data/jwhois-4.0-fix-ipv6socket.patch
patch -p1 < jwhois-4.0-fix-ipv6socket.patch
mkdir /usr/local/jwhois
./configure --prefix=/usr/local/jwhois/
make -j4
make install