Skip to content

Instantly share code, notes, and snippets.

View ynaoto's full-sized avatar

Naoto Yoshioka ynaoto

View GitHub Profile
# -*- coding: utf-8 -*-
import sys
import codecs
sys.stdout = codecs.getwriter('utf_8')(sys.stdout)
import itertools
for a in ["".join(p) for p in itertools.permutations(u"たかやまうこん")]:print a
@ynaoto
ynaoto / gist:8204752
Created January 1, 2014 03:26
git commit で影響を与えたファイル名一覧 (1000は適当に調整)
$ git diff --stat=1000 開始 終了
@ynaoto
ynaoto / gist:8204749
Created January 1, 2014 03:25
git commit 履歴一覧
$ git log --oneline .
@ynaoto
ynaoto / xpng
Created December 9, 2013 05:31
PNGファイルの構造をざざっと見る
#include <stdio.h>
#include <ctype.h>
typedef unsigned char BYTE;
typedef int INT4;
int main()
{
BYTE pngHdr[8];
BYTE buf4[4];
@ynaoto
ynaoto / gist:7148614
Created October 25, 2013 02:29
あるレポの一部を、他のレポにコピー
cd /src_repo
git subtree split -P path/to/folder -b PathToFolder_branch
cd /dst_repo
git pull /src_repo PathToFolder_branch
git push
cd /src_repo
git branch -D PathToFolder_branch
@ynaoto
ynaoto / gh-pages
Created October 24, 2013 15:51
github pages
git checkout gh-pages
git merge master
git push origin gh-pages
Add the following 2 lines to the [remote "origin"] section of .git/config:
push = +refs/heads/master:refs/heads/gh-pages
push = +refs/heads/master:refs/heads/master
@ynaoto
ynaoto / gist:6886096
Created October 8, 2013 15:00
Hello World
a;main(){int b=++a+a,c=b+b,d=c+c,e=d+d,f=e+e,g=f+f,h=g+f+c,i=d+b+a,j=g+d;char s[]={j,h+a,h+d,h+d,h+i,f,j+e-a,h+i,h+e-b,h+d,h,b+d,--a};puts(s);}
@ynaoto
ynaoto / gist:6794477
Created October 2, 2013 14:16
ローカルな git ディレクトリを取り込む
cd foo # .git があって github で管理しているところ
git remote add a /bar # ローカルな .git があるところ
git subtree add --prefix=bar a master
git push
git remote rm a
@ynaoto
ynaoto / gist:6061998
Created July 23, 2013 12:27
Install PEAR, PHP_CodeSniffer and PHPCompatibility on Max OS
sudo php /usr/lib/php/install-pear-nozlib.phar
sudo pear install PHP_CodeSniffer
cd /usr/lib/php/pear/PHP/CodeSniffer/Standards
sudo mv ~/git/PHPCompatibility .
sudo cp php.ini.default php.ini
sudo vi php.ini # add /usr/lib/php/pear to include_path
phpcs --standard=PHPCompatibility a.php
# adduser foo
# passwd foo
# visudo