Skip to content

Instantly share code, notes, and snippets.

KUWASHIMA Yuichiro kuwa72

Block or report user

Report or block kuwa72

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
@kuwa72
kuwa72 / reciprocal.rb
Last active Feb 6, 2018
Naive implement n/1 enumerator.
View reciprocal.rb
class Reciprocal
include Enumerable
def initialize(i)
@denon = i
end
def each
numer = 1
nums = []
loop do
@kuwa72
kuwa72 / script.js
Created Dec 11, 2017
User script: Markdown highlighting in Redmine wiki.
View script.js
(function() {
'use strict';
// Your code here...
var loading = '<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">';
$('head').append(loading);
$.getScript("https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.js", () => {var simplemde = new SimpleMDE({ element: $("#content textarea")[0] });});
})();
@kuwa72
kuwa72 / nulpo.sh
Last active Aug 30, 2017
ぬるぽガッ
View nulpo.sh
yes 'echo $((RANDOM%3))' | bash | head -n 100 | while read X;do E=$P;P=$N;N=$X; echo $X;if [[ "$N" == 2 && "$P" == 1 && "$E" == 0 ]];then echo "ガッ!!!";break;fi;done | sed -e 's/0/ぬ/' -e 's/1/る/' -e 's/2/ぽ/'
@kuwa72
kuwa72 / firepattern.sh
Last active Aug 17, 2017
Rendering fire on terminal(no noise), based on 炎上のさせ方講座(じゃがりきん) https://twitter.com/jagarikin/status/894452278463053824
View firepattern.sh
x=$(gshuf -i 196-226 -r|head -n 20|xargs);for ((i=0;i<30;i++));do y=$x;x=$((echo $x|cycle|head -n 2;echo $x|cycle|tail -n 1;echo $y)|awk '{for(i=1;i<=NF;i++){a[i]+=$i}}END{for(x in a)printf int(a[x]/4)" ";print ""}');echo $x;done|awk '{for(i=1;i<=NF;i++){printf "\033[48;05;%dm%d",$i,$i};print"\033[m"}' | gtac
@kuwa72
kuwa72 / v29q2.sh
Last active Jul 4, 2017
シェル芸勉強会 29回 Q2
View v29q2.sh
cat attend | php -B '$n=explode(",",chop(file_get_contents("attend6")));' -R '$l=explode(" ",$argn);echo "$l[0] $l[1] $l[2]",in_array($l[0], $n)?"出":"欠","\n";'
@kuwa72
kuwa72 / lg.zsh
Created Mar 31, 2017
Life game(requirements: zsh, egzact. Tested on OSX).
View lg.zsh
#!/usr/bin/env zsh
FO=$(cat)
X=$(head -n 1 <<<$FO)
YL=$(echo $FO|wc -l|bc)
FF=$((echo $X|tr 1 0;echo $FO;echo $X|tr 1 0)|addl 0\ |addr \ 0)
for L in {1..$YL};do
for C in {1..$(echo $X|awk '{print NF}')}; do
echo $FF | sed -n $L,$((L+2))p | cut -d \ -f $C,$((C+1)),$((C+2)) | xargs | {
read B
if echo $B | grep -q '. . . . 1 . . . .';then
@kuwa72
kuwa72 / friends.sh
Created Feb 23, 2017
すごーい!!ターミナル
View friends.sh
#!/bin/sh
perl -pe 's/(\S)(\S)?(\S)?(\S)?(\S)?(\S)?(\S)?(\S)?(\S)?(\S)?(\S)?(\S)?(\S)?/\x1b[48;5;231m\x1b[38;5;35m$1\x1b[38;5;76m$2\x1b[38;5;208m$3\x1b[38;5;202m$4\x1b[38;5;30m$5\x1b[38;5;162m$6\x1b[38;5;25m$7\x1b[38;5;39m$8\x1b[38;5;245m$9\x1b[38;5;208m$10\x1b[38;5;160m$11\x1b[38;5;160m$12\x1b[38;5;54m$13/g'
@kuwa72
kuwa72 / 27-q6.sh
Created Feb 15, 2017
Emacsシェル芸サンプル(27回Q6) https://blog.ueda.asia/?p=9309
View 27-q6.sh
echo 1 | emacs -Q --batch --insert /dev/stdin --eval '(let ((bs (substring (buffer-string) 0 1))) (defun x (i s) (if (< i 10) (progn (princ (concat s "\n"))(x (+ i 1) (concat s bs))))) (x 0 bs) )'
@kuwa72
kuwa72 / 27-q1.sh
Last active Feb 15, 2017
Emacsシェル芸サンプル(27回Q1)https://blog.ueda.asia/?p=9309
View 27-q1.sh
echo abcdefghijklmn | emacs -Q --batch --insert /dev/stdin --eval '(progn (while (re-search-forward "\\(.\\)\\(.\\)" nil t) (replace-match (concat "\\1" (capitalize (match-string 2))) nil nil))(princ (buffer-string)))'
@kuwa72
kuwa72 / bf.sh
Created Jan 19, 2017
One line brainfuck compiler
View bf.sh
{grep -o . | (echo '{ ptr=1;memory=() ';awk '/\[/{print "while [[ memory[$ptr] -ne 0 ]];do"} /\]/{print "done;"}/\+/{print "let $((memory[$ptr]++));"} /-/{print "let $((memory[$ptr]--));"} />/{print "let $((ptr++));"} /</{print "let $((ptr--));"} /\./{print "printf \"\\x$(printf %x $((memory[$ptr])))\";"} /,/{print "memory[$ptr]=$(head -c 1);"}';echo '}') | sh}
You can’t perform that action at this time.