Skip to content

Instantly share code, notes, and snippets.

View licht's full-sized avatar
💭
I may be slow to respond.

licht

💭
I may be slow to respond.
View GitHub Profile
@np-nakayama
np-nakayama / file0.txt
Created August 18, 2014 01:34
稼働中のMySQLを無停止でレプリケーション環境を構築する ref: http://qiita.com/hit/items/7747394e8f2f6a515535
mysqldump -h remote_host --databases schema1 schema2 -u myuser -pmypasswd --master-data --single-transaction --routines > /tmp/myDB.dump
@saitodev
saitodev / get_authkey.sh
Last active April 24, 2016 07:27
ネットラジオを聴くためのスクリプト。Python製
#!/bin/bash
# -*- coding: utf-8 -*-
PLAYER_URL='http://radiko.jp/player/swf/player_4.1.0.00.swf'
wget $PLAYER_URL -O player.swf
swfextract -b 14 -o authkey.png player.swf
rm -f player.swf
@masarufuruya
masarufuruya / file0.php
Created May 25, 2014 06:06
PHPで連想配列を日本語エンコードしてCSV出力する ref: http://qiita.com/masarufuruya/items/e5e348ae325740c49795
$data = array(
array('佐藤', '東京都', '29歳'),
array('田中', '千葉県', '31歳'),
array('鈴木', '北海道', '54歳')
);
@yuu-ito
yuu-ito / pref_code.csv
Last active February 1, 2016 05:28
d<-read.csv("../../Desktop/pref_code.csv") http://ja.wikipedia.org/wiki/全国地方公共団体コード
PREF_CODE NAME REGION
01 北海道 北海道
02 青森県 東北
03 岩手県 東北
04 宮城県 東北
05 秋田県 東北
06 山形県 東北
07 福島県 東北
08 茨城県 関東
09 栃木県 関東
@matchy256
matchy256 / putgmusic.py
Last active October 17, 2018 13:35
GoogleMusic に音声ファイルをアップロードするスクリプト。要 https://github.com/simon-weber/Unofficial-Google-Music-API 。第1引数にファイル名、第2引数にプレイリスト名(省略可)。Google ID とパスワードは自分のものに書き換えること
#!/usr/bin/env python
from gmusicapi import Musicmanager
from gmusicapi import Mobileclient
import sys
import os.path
params = sys.argv
if len(params) < 2:

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns                     on recent CPU
L2 cache reference ........................... 7 ns                     14x L1 cache
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns                     20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs 4X memory

@takeru
takeru / crontab
Last active February 23, 2016 09:27 — forked from j3tm0t0/crontab
./rec_radiko.sh: 127: ./rec_radiko.sh: Syntax error: "(" unexpected ってなるから。
MAILTO=j3tm0t0@gmail.com
# ANN
59 0 * * 5 sh ~/bin/rec_radiko.sh LFR 122 ~/mp3/"ナインティナインのオールナイトニッポン "
59 0 * * 7 sh ~/bin/rec_radiko.sh LFR 122 ~/mp3/"オードリーのオールナイトニッポン "
# ANN0
59 2 * * 5 sh ~/bin/rec_radiko.sh LFR 122 ~/mp3/"Hi-Hiのオールナイトニッポン0 "
# JUNK
59 0 * * 2 sh ~/bin/rec_radiko.sh TBS 122 ~/mp3/"JUNK 伊集院光・深夜の馬鹿力 "
@miohtama
miohtama / gist:5858518
Created June 25, 2013 13:40
Checking if IP address is on Tor exit node list with Django, Celery and memcached
"""
Tor IP checks
"""
import requests
from django.core.cache import cache
@poppen
poppen / radiru_rec.sh
Created June 21, 2013 05:31
wrapper script for rtmpdump to record NHK radiruradiru
#!/bin/bash
usage_exit() {
echo "Usage: $0 [-c channel (r1/r2/fm, default:r1)] [-t recording_seconds (default:1800)] " 1>&2
echo " r1: NHK-Radio No.1 / r2: NHK-Radio No.2 / fm: NHK-FM"
exit 1
}
#
# options
# 2017年9月以降は Flash ではなく m3u8 での配信になりましたので、この内容は古くなりました。
# 新しい録音方法に関しては
# https://gist.github.com/riocampos/93739197ab7c765d16004cd4164dca73
# をご覧ください。
##############################################################################
# RTMPEのtype9 handshakeに対応している必要があるのでRTMPDump v2.4必須
# ラジオ第2は全放送局とも同じ
# swfVfyオプションのURLは http://www3.nhk.or.jp/netradio/files/swf/rtmpe.swf でもOK
# 各チャンネルに2種類ずつ記載していますがどちらも同じなので好みの物を使ってください