Skip to content

Instantly share code, notes, and snippets.

@akiniwa
akiniwa / make3Dim.py
Created January 30, 2014 03:31
create N dimension dataframe
def make3Dim(N, pd):
a = []
b = []
c = []
for i in range(N):
for j in range(N):
for k in range(N):
a.append(i)
b.append(j)
c.append(k)
<Directory /var>
Options All
AllowOverride All
</Directory>
@akiniwa
akiniwa / gist:8818596
Created February 5, 2014 07:02
枠線
<p><span itemscope itemtype="http://schema.org/Photograph"><img src="http://cdn-ak.f.st-hatena.com/images/fotolife/A/Akiniwa/20140205/20140205152239.png" alt="f:id:Akiniwa:20140205152239p:plain" title="f:id:Akiniwa:20140205152239p:plain" class="hatena-fotolife" itemprop="image" style="border: 1px solid #ccc"></span></p>
cat file | ruby -n -a -e 'puts "#{$F[0] $F[1]}"'
Extract 1% lines from many lines in .txt file
And you may need header line.
## awk
awk 'BEGIN {srand()} !/^$/ { if (rand() <= .01 || FNR==1) print $0}' order.txt > dom.txt
## perl
heroku git:clone -a myapp
curl -H "$AUTH_HDR" -X POST -d '{"name":"matlab2python"}' https://api.github.com/user/repos
これは便利!重複を取り除くawk、sort&uniqより速い!
awk '!x[$1]++{print $1}'
sed -e "s/\(201[0-9]-[0-9]\{2\}-\)\(0[1-9]\|10\)/\11/g" -e "s/\(201[0-9]-[0-9]\{2\}-\)\(1[1-9]\|20\)/\12/g" -e "s/\(201[0-9]-[0-9]\{2\}-\)\(2[1-9]\|30|31\)/\13/g" month.txt > _month.txt
for f in *.txt;
do mv $f `echo $f | sed 's/\(^.*\).txt_cr/\1/g'`;
done