Skip to content

Instantly share code, notes, and snippets.

View wittyfool's full-sized avatar
🎯
Focusing

土屋信成 wittyfool

🎯
Focusing
View GitHub Profile
from m5stack import *
from m5ui import *
from uiflow import *
import time
rgb.set_screen([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
list = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
def push_five(x):
@wittyfool
wittyfool / amazon-calc.js
Last active April 29, 2021 10:05 — forked from polamjag/amazon-calc.js
Amazon で使った金額の合計を出す奴 (2014-2016 年バージョン)
// Amazon で使った金額の合計を出す奴
//
// 使い方:
// 1. 全部コピーする (右上の Raw をクリックした先でやるのが楽)
// 2. Amazon の注文履歴ページ ( https://www.amazon.co.jp/gp/css/order-history/ ) を開く
// 3. F12 または 右クリ→要素の検証 とかで出てくる開発者ツールのコンソール (JavaScript REPL) にペースト
// 4. エンターで実行
// (Firefox はなんか allow pasting とタイプしろみたいなことを言われるので従う)
// 5. しばらく待つと alert で合計金額を表示
//
@wittyfool
wittyfool / Makefile
Last active October 17, 2017 05:27
時間のかかるMakefileで重複処理を防止する ref: http://qiita.com/wittyfool@github/items/8636ce29726039e88e43
sync:
kill -0 `tail -1 sync.pid` || $(MAKE) sync_do
sync_do:
ps -p $$$$ -o ppid > sync.pid
rsync -auz /opt/data remotesite:/opt/remote-data/
clean:
LIST=cat dog horse cow
do_it:
@LIST="$(LIST)";\
for x in $$LIST; do\
touch $$x ;\
done
@wittyfool
wittyfool / tohash.pl
Last active August 29, 2015 14:18
キーで始まるcsv ファイルをハッシュにする
%data = map { shift @$_, $_ } map { [ split(/,\s*/, $_) ]} split(/\n/, $contents);
@wittyfool
wittyfool / pipe2idobata.pl
Last active August 29, 2015 14:16
apacheのアクセスログをidobataのhookに ref: http://qiita.com/wittyfool@github/items/4e76fabca4021459d871
#!/usr/bin/perl
$|=1;
while(<>){
open(PIPE, "|/usr/bin/curl --data-urlencode source\@- https://idobata.io/hook/.......") || next;
print PIPE $_;
close(PIPE);
}
@wittyfool
wittyfool / pngfix.pl
Created February 26, 2015 02:00
Remove IDAT chunk of length 0 for png
#!/usr/bin/perl -s
# photohop 等で作成するpng には
# 長さ0のIDAT チャンクが作成される事がある
# ImageMagick等でエラーとなり読み込めない事があるので取り除く
#
$src = shift || usage();
$dst = shift || usage();
sub usage {
print "Remove IDAT chunk of size 0\n";
@wittyfool
wittyfool / codingStyle.md
Last active May 8, 2018 09:36
ミニマリストのコーディングスタイル

ミニマリストのコーディングスタイル(Perl)

  • 寿命の短すぎる変数を使わない
# before
$filename='/foo/bar/config.txt';
open(FP, '<', $filename) || die $@;
#
# after
open(FP, '&lt;', '/foo/bar/config.txt') || die $@;

mt_rand(); // より良い乱数

@wittyfool
wittyfool / teraterm.md
Last active August 29, 2015 14:00
TeraTerm(Windows用telnet/sshクライアント)

TeraTerm(Windows用telnet/sshクライアント)のインストール

VectorからTeraTermをダウンロードします。
http://www.vector.co.jp/soft/win95/net/se320973.html

接続する時には次の項目を指定する。
通常のssh接続の場合は括弧内を指定する

  • TCP/IP / Serial (TCP/IP)
  • Host (指定されたもの)