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: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 / osc_copy.vim
Last active Aug 7, 2017
OSC52 copy with Vim
View osc_copy.vim
" Clipboard integration by Operating System Controls from Vim
" Usage:
" Yank something and run :OscCopy
" or
" Copy range in visual mode and run :'<,'>OscCopyRange
" From: https://stackoverflow.com/questions/1533565/how-to-get-visually-selected-text-in-vimscript
function! GetVisualSelection()
let [lnum1, col1] = getpos("'<")[1:2]
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
@greymd
greymd / gist:d89a2fd6605771c2273118b047b7b5ae
Last active Jul 28, 2017
Wikipediaの数の性質を500まで集める
View gist:d89a2fd6605771c2273118b047b7b5ae
# スクレイピング
seq 500 \
| while read n;do echo "$n"; w3m -dump -cols 999 "https://ja.wikipedia.org/wiki/$n" | sed -n '/性質\[編集\]/,/\[編集\]/p' > "$n" ;done
# 最も性質が多い数は。。
seq 500 | while read f; do echo -n "$f "; cat "$f" | grep '•' | grep -c .; done | sort -k2,2n
.
.
.
@greymd
greymd / same2.egi
Created Jul 27, 2017
Filter numbers which has 2 same factors with Egison
View same2.egi
#!/usr/bin/env egison
(define $main
(lambda [$args]
(each display
(farray-same2 farray))))
(define $farray
(filter 1#(eq? (length %1) 3)
(map (p-f $) (take 100 nats))))
@greymd
greymd / make_init.php.bash
Created Jul 25, 2017
Create loading file from multiple php class files under lib directory.
View make_init.php.bash
#!/bin/bash
THIS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-${(%):-%N}}")"; pwd)"
files=("$(find ${THIS_DIR-}/lib -type f)")
class_lines=("$(printf '%s\n' "${files[@]}" \
| xargs -n 1 grep -m 1 -E '^(abstract )?class' \
| sed -r 's/^.*class ([A-Za-z]+)/\1/')")
class_names=("$(printf '%s\n' "${class_lines[@]}" | awk '{print $1}')")
remove_buildin_classes () {
@greymd
greymd / Test.java
Created Jul 19, 2017
Prime numbers with Java
View Test.java
import java.util.HashMap;
import java.util.Map;
class Test {
public static void main(String args[]) {
int num = 100;
Map<Integer, Boolean> list = new HashMap<Integer, Boolean>();
for (int i = 2; i <= num; i++) {
list.put(i, true);
}
@greymd
greymd / 2015Cm.egi
Created Jul 14, 2017
【話題の一行問題】東大数学2015第5問【2015Cmが偶数】をEgisonで解く
View 2015Cm.egi
; 【話題の一行問題】東大数学2015第5問【2015Cmが偶数】をEgisonで解く
; https://www.youtube.com/watch?v=MfrT_QGCkRo
(define $main
(lambda [$argv]
(each display
(match
(map 1#(2#[%1 %2 (modulo %2 2)] %1 (comb 2015 %1))
(take 2015 nats))
(list [integer integer integer])
@greymd
greymd / reg_calendar.txt
Last active Jul 9, 2017
2016年〜2021年までのカレンダー(詳細はコメント欄を参照)
View reg_calendar.txt
2016-01-01 金 元日 1
2016-01-02 土 三が日 1
2016-01-03 日 三が日 1
2016-01-04 月 平日 0
2016-01-05 火 平日 0
2016-01-06 水 平日 0
2016-01-07 木 平日 0
2016-01-08 金 平日 0
2016-01-09 土 休日 1
2016-01-10 日 休日 1
You can’t perform that action at this time.