Skip to content

Instantly share code, notes, and snippets.

Avatar

Takamura Narimichi nari-ex

View GitHub Profile
View graphql_get_all_filelds
query roots {
__schema {
queryType {
...typeFields
}
mutationType {
...typeFields
}
subscriptionType {
...typeFields
View keybase.md

Keybase proof

I hereby claim:

  • I am nari-ex on github.
  • I am nari_ex (https://keybase.io/nari_ex) on keybase.
  • I have a public key ASBzSuF8RetAd5K8R3e9N4PgHCKvYurJFhoY6e9kJLG_lAo

To claim this, I am signing this object:

@nari-ex
nari-ex / install_mariadb10.0_and_maxscale1.2.txt
Last active Oct 21, 2015
Install mariadb v10.0 and maxscale v1.2
View install_mariadb10.0_and_maxscale1.2.txt
# 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
View rice_brand.json
{
"brand": [
"夢ごこち",
"",
"初星",
"四国",
"春陽",
"朝日",
"秋晴",
"でわ75ひかり",
View create_large_file.sh
# 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
View slow_copy.sh
# rsync コマンドを用いるケース
rsync -av --bwlimit 10000 src dst
# tar + pv コマンドを用いるケース
tar czvf - src | pv -L 2048k | cat - > /path/to/dist
View slow_move.sh
find . -print -exec sleep 0.1 \; | xargs -n1 -I%% mv %% dst_dir/
View slow_remove.sh
find ./ -exec sleep 0.1 \; -delete -print
View remove_large_file.sh
#/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});
@nari-ex
nari-ex / rename.py
Created Feb 9, 2015
大量のファイルを移動するスクリプト
View rename.py
#!/usr/bin/env python
# coding: utf-8
import os
import time
src_dir = ""
dst_dir = ""
import_file = ""
export_file = ""