Skip to content

Instantly share code, notes, and snippets.

😉
Nanchatte

Yasuhiro Yamada greymd

😉
Nanchatte
  • Dublin, Ireland
Block or report user

Report or block greymd

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:efc0f69d76925e599c32844a767f653a
## From: https://en.wikipedia.org/wiki/Dc_(computer_program)
## prime number
2p # A = 2; print A
3p # A = 3; print A
## スタックの先頭にある数とsqrt(処理中の数)を計算
[ # func f-# (int n) int {
d # A = n(試す数)
l! # B = ! -- nと試し割りの割る数を用意
@greymd
greymd / ddst.md
Last active Mar 31, 2018
Detect daylight saving time with date
View ddst.md
$ echo 20180311" "{01..23}":00:00 JST" | xargs -n3 | TZ=America/New_York gdate -f-
Sat Mar 10 11:00:00 EST 2018
Sat Mar 10 12:00:00 EST 2018
Sat Mar 10 13:00:00 EST 2018
Sat Mar 10 14:00:00 EST 2018
Sat Mar 10 15:00:00 EST 2018
Sat Mar 10 16:00:00 EST 2018
Sat Mar 10 17:00:00 EST 2018
Sat Mar 10 18:00:00 EST 2018
View gist:9527645a73662b641a34d6c07e459ae5
$ dc -e'0[1+ddn10P10>r]srlrx'
1
2
3
4
5
6
7
8
@greymd
greymd / pandoc_gfm.md
Created Dec 11, 2017
pandoc_markdown
View pandoc_gfm.md

[1]{.header-section-number} AAA

AAAの紹介をします

[1.1]{.header-section-number} AAAの背景

これはAAAの背景です

@greymd
greymd / inverse-fizzbuzz.md
Last active Sep 24, 2017
Inverse Fizzbuzz with Egison
View inverse-fizzbuzz.md
@greymd
greymd / collection2array.egi
Created Sep 23, 2017
Convert Collection to Array in Egison
View collection2array.egi
(define $collection2array
1#(generate-array (nth $ %1) [1 (length %1)]))
; > (collection2array {a b c})
; (|a b c|)
View gist:3581be4933ec1c8dc52327d435f49356
愛 11100110 10000100 10011011
$ seq 1 1023 | dec2bin | sed 's/^/0000000000/' | grep -oE '.{12}$' | awk -vFS= -vOFS= '{print 111,$1,$2,11,$3,1,$4,$5,$6,$7,1,$8,$9,1,$10,$11,11,$12,11}' | perl -nle 'print pack ("B*", $_);' | grep 生
$ seq 1 1023 | dec2bin | sed 's/^/0000000000/' | grep -oE '.{12}$' | awk -vFS= -vOFS= '{print 111,$1,$2,11,$3,1,$4,$5,$6,$7,1,$8,$9,1,$10,$11,11,$12,11}' | perl -nle 'print pack ("B*", $_);' | grep 死
@greymd
greymd / gist:cfc37da72e7f2313b70d56eb68e6f0dc
Created Sep 14, 2017
Bmp file analysis with ShellScript
View gist:cfc37da72e7f2313b70d56eb68e6f0dc
# Extract size from information header. 14 is the octet length of file header.
od -tx1 -An flower.bmp \
| tr -dc 'a-z0-9' \
| fold -w 2 \
| sed -n '14,15p' \
| tr -d '\n' \
| sed 's/./\U&/g;s/^/obase=10;ibase=16;/' \
| awk 1 \
| bc \
| awk '{print $1+14}'
@greymd
greymd / ping_nyan.sh
Last active Sep 28, 2018
通常のpingで「にゃーん」を表示するシェル芸
View ping_nyan.sh
#!/bin/bash
# From: https://twitter.com/grethlen/status/906154326975905793
sudo ping -i 0 -c 1400 pong4.kooshin.net \
| grep -oP "icmp_seq=\K\d+" \
| cat - <(seq 1 1400) \
| sort -n \
| uniq -c \
| awk '{printf $1}' \
| fold -w70 \
View gist:19f08965bda7364dd07b5fdf01fc8fd9
$ convert -background white -fill black -font ~/Library/Fonts/GenEiGothicP-Bold.otf -pointsize 48 label:和歌山 pbm:- | pbmtoascii
oo
ooooMMMo o oooo o oooo ooo oo o MMMMMM MoMMoo
o ooooMoMMMMMMMMMMo MMMMMMMMMMMMMMMMMMMMMMMM MMMMM" MMMMMM
MMMMMMMMMMMMMMMMM""" MMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMM oMMMMM MMMMMM
"MMMMMMMMMMMM" "MMMMMMMMMMMMMMMMMMM MMMMM MMMMMM o MMMMMM
" MMMMMM MMMMMMMM"M""MMMMMMM MMMMMMMMMMM" MMMMM oMMMMMMMMMMMMMMMMMMM MMMMMM
You can’t perform that action at this time.