Skip to content

Instantly share code, notes, and snippets.

We couldn’t find that file to show.
@kou029w
kou029w / bf2kemono.sh
Last active February 8, 2017 16:42
create a kemono code that outputs a given brainfuck
#!/bin/bash
# なにこれなにこれ!
# https://github.com/consomme/kemono_friends_lang
s='s/>/たのしー:+/たーのしー:</すごーい:-/すっごーい:\[/うわー:]/わーい:\./なにこれなにこれ:,/おもしろーい:^.$//';grep -o . "$@"|sed "${s//:/!/;s/}"|tr -d \\n
@kou029w
kou029w / bf.sh
Last active January 5, 2021 02:43
a brainfuck compiler written in bash
#!/bin/bash
grep -o . "$@"|sed '/\./cprintf 0x%x $((m[p]))|xxd -r
/\[/cwhile((m[p]));do
/]/cdone
/</c((p--))
/>/c((p++))
s/[+-]/((m[p]&&))/
/^.$/d'
@kou029w
kou029w / factor.sh
Last active October 5, 2017 11:51
factor.sh
#!/bin/bash
# i=$1 p=${2:-2}
# while (( i != 1 )); do
# if (( i % p )); then
# (( p++ ))
# else
# echo $p
# (( i /= p, p = 2 ))
# fi
@kou029w
kou029w / stdin2factor.sh
Created January 18, 2017 11:23
stdin2factor.sh
#!/bin/bash
# while read i; do
# scr=`echo $i \
# | grep -oE [0-9]+ \
# | factor \
# | sed 's/ //;
# s/ /x/g;
# s/.*/s:&:;/'`