Skip to content

Instantly share code, notes, and snippets.

@feiz
feiz / avrdude.sh
Last active December 22, 2018 18:44 — forked from nyomo/avrdude.sh
WSLでavrdudeを簡単に使う為の奴 qmk用
MODECMD='/mnt/c/Windows/System32/mode.com'
COMPORT1=$(${MODECMD}|grep -o 'COM[0-9]*')
COMPORT2=""
while [ "$COMPORT2" = "" ];do
sleep 0.5
printf "."
COMPORT2=$(${MODECMD}|grep -v '${COMPORT1}'|grep -o 'COM[0-9]*')
done
PORTNUM=$(echo $COMPORT2|sed -e 's/COM//')
avrdude -c avr109 -p atmega32u4 -P /dev/ttyS${PORTNUM} -U flash:w:$*
@feiz
feiz / fjencode
Last active June 1, 2017 09:18
:fuji::moto::you::ichi:
#!/usr/local/bin/python3
import sys
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('text', type=str, default=sys.stdin, nargs='?')
grp = parser.add_mutually_exclusive_group(required=True)
grp.add_argument('--decode', '-d', action='store_true', default=True)
grp.add_argument('--encode', '-e', action='store_true', default=False)
@feiz
feiz / datt
Created April 19, 2017 06:57
dockerコンテナにガッとattachするやつ
#!/bin/sh
# usage
# datt PIECE_OF_CONTAINER_NAME
#
# example
# $ datt app1
# $ datt postg psql -U myuser mydatabase
#
# This is useful for using pdb.
@feiz
feiz / dcon
Created March 10, 2017 08:09
dockerコンテナにガッとつなぐやつ
#!/bin/sh
# usage
# dcon PIECE_OF_CONTAINER_NAME [COMMAND [ARGUMENTS...]]
#
# example
# $ dcon app1
# $ dcon postg psql -U myuser mydatabase
name=$1
shift 1
@feiz
feiz / gist:894bf01d1523ea2ca634
Last active August 29, 2015 14:20
かよちんjs
void(!function(d){function x(nodes){for(var i in nodes){var n=nodes[i];if(n.nodeType==3){var nt="";for(var i in n.wholeText){if(!/[\s\nがぎぐげござじずぜぞだぢづでどばびぶべぼぱぴぷぺぽガギグゲゴザジズゼゾダヂヅデドバビブベボパピプペポ]/.test(n.wholeText[i])){nt+=n.wholeText[i]+"\u3099";}else{nt+=n.wholeText[i]}}n.textContent=nt}else{x(n.childNodes)}}}x(d.body.childNodes)}(document));
@feiz
feiz / gist:f216762d7741ed5b4c9a
Created October 16, 2014 09:31
リモートでssh-keygenして別のホストにpubkeyを設定する
- hosts: foo
tasks:
- command: ssh-keygen ...
- fetch:
src: ~/.ssh/id_rsa.pub
dest: _pubkey
- hosts: bar
tasks:
- authorized_key:
@feiz
feiz / gist:8240253
Last active January 2, 2016 02:58
インスペクタデバッグ
1. インスペクタを開き、艦隊情報タブを開く
2. 左下のボタンを長押しし、出てきたボタンを押してインスペクタをウィンドウ化
 参考: http://gyazo.com/a5f1ebcde0ab2460b506e29898ee86c1
3. ウィンドウ化したインスペクタにフォーカスを合わせ、Ctrl+Shift+Jでインスペクタのインスペクタを開く
4. 開いたインスペクタ上でsources > hcjpbcmhppmlohedljpeagnjplpjonhc/js/dispatcher.jsをダブルクリックして開く
5. 開いたソースの17行目"hdr.execute(content);"の上に以下のコードを追加
console.log(content);
5.参考画像: http://gyazo.com/208b0e4c93da5f5e0baf7d0eaa979d35
@feiz
feiz / gist:5795317
Created June 17, 2013 07:58
try_filesとinternal path(@xxx)を使って静的ファイルをややこしくserveするnginx.confのjinja2 template
server {
# UAからOSを検出
set $osversion "";
if ($http_user_agent ~ "AppleWebKit/(\d{3})"){
set $osversion ".AppleWebKit.$1";
}
# manifestファイルはOS個別のものがあればそちらを出す
# なければ/static/manifest/にあるデフォルトを使う
$(function (){
$('tr').each(function (i, e){
var row = $(e);
var link = $(row.children()[2])
var a = link.children('a');
var url = a.attr('href');
if (!url) {return;}
url = url.split('/');
user_id = url[url.length-1];
var yasumi_key = 'yasumi_' + user_id;
@feiz
feiz / gist:4123968
Created November 21, 2012 09:27
大日本帝国
# coding: utf8
from itertools import cycle
for wd in cycle((u"月",u"月",u"火",u"水",u"木",u"金",u"金")):
print(wd)