Skip to content

Instantly share code, notes, and snippets.

View mikkun's full-sized avatar
🐧
:(){ :|:& };:

KUSANAGI Mitsuhisa mikkun

🐧
:(){ :|:& };:
View GitHub Profile
@mikkun
mikkun / .xmobarrc
Last active February 12, 2024 16:50
My xmonad and xmobar configuration files
-- vim: set filetype=haskell:
Config
{ font = "Noto Sans CJK JP Bold 9"
, additionalFonts = ["Symbola 9"]
, bgColor = "#3d3846"
, fgColor = "#ffffff"
, border = FullB
, borderColor = "#3d3846"
, borderWidth = 4
, position = TopH 20
@mikkun
mikkun / rpi-pir-alarm
Last active September 14, 2020 16:55
「第37回シェル芸勉強会 大阪サテライト LT」( https://speakerdeck.com/mikkun/shell-script-for-raspberry-pi )で紹介したシェルスクリプト
#!/bin/bash --
# Name : rpi-pir-alarm
# Purpose : Motion Detection and Email Notification Using Raspberry Pi
#
# Author : KUSANAGI Mitsuhisa <mikkun@mbg.nifty.com>
# License : MIT License
# Usage : ./rpi-pir-alarm
@mikkun
mikkun / BioShellGei_01_Answers.txt
Created October 21, 2017 16:41
「シェル芸勉強会 meets バイオインフォマティクス vol.1」解答例
「シェル芸勉強会 meets バイオインフォマティクス vol.1」解答例
資料URL: https://bio-shell.connpass.com/event/66089/presentation/
問題URL: https://www.slideshare.net/EmiHattori1/ss-80854726
A1:
$ echo 'Gorilla gorilla' | perl -nlE 's/ori/a/g;s/a\b/us/g;say'
Gallus gallus
@mikkun
mikkun / BannerGei.txt
Created July 1, 2017 14:24
「第29回シェル芸勉強会 大阪サテライト LT」で使用したスライドのような何か("history -r BannerGei.txt"で読み込んで下さい)
center(){ printf "%*s\n" $(((${#1}+$(tput cols))/2)) "$1"; };tput reset;printf "<?xml?><svg><text font-size='20'>帰ってきたバナー芸"|convert - pbm:-|pbmtoascii;printf "<?xml?><svg><text font-size='20'> +手書きSVG"|convert - pbm:-|pbmtoascii;center 'KUSANAGI Mitsuhisa(@mikkun_jp) 2017年7月1日';center '第29回シェル芸勉強会';center '大阪サテライトLT大会'
tput reset;printf "<?xml?><svg><text font-size='20'>1. 流れる「toilet」"|convert - pbm:-|pbmtoascii
A=$(printf "<?xml?><svg><text font-size='40'>うんこ💩|"|convert - pbm:-|pbmtoascii|sed 's/[^ ]\+$//');:(){ clear;echo "$A";A=$(echo "$A"|sed -r 's/(.)(.*)/\2\1/');sleep .03;:;};:
tput reset;printf "<?xml?><svg><text font-size='20'>2. 回転寿司"|convert - pbm:-|pbmtoascii
D=0;while :;do echo "<?xml?><svg xmlns:xlink='http://www.w3.org/1999/xlink'><rect x='0' y='0' height='90' width='90' style='fill:none;stroke:black'/><path id='C' d='m60,45 a15,15 0 1 1 -30,0 15,15 0 1 1 30,0 z' style='fill:none;stroke:none'/><text transform='rotate($D,45,45)' font-family='IPA明朝' style='font-size:30px;fill:black'><textPath xlin
@mikkun
mikkun / .gitmessage.txt
Last active October 21, 2017 16:25
Git commit message template to use Emoji Prefix
# The subject line
# The body of a commit message.
# Resolves: #123
# Git commit message template to use Emoji Prefix
# ===============================================
#
# Consider starting the commit message with an applicable emoji:
@mikkun
mikkun / OneLiner-TechLION-20151202.txt
Created December 2, 2015 14:35
「シェル芸勉強会の前座的な手抜き」の解答例
「シェル芸勉強会の前座的な手抜き」の解答例
問題URL: http://techlion.jp/archives/9691
問題
連結したら素数になるという素数のペアを、ワンライナーでなるべくたくさん挙げてみましょう。
例: 2と3(連結したら23で素数。)
@mikkun
mikkun / 17thArtsOfShellOneLiners.txt
Created June 18, 2015 19:55
「第17回ジュンク堂はシェル芸が乗っ取った勉強会」解答例
2015/06/18「第17回ジュンク堂はシェル芸が乗っ取った勉強会」の解答例
問題URL: http://blog.ueda.asia/?p=6454
A1-1:
cat data1 | sort -k1,1 | awk 'BEGIN{ORS=""}{print $1!=prev?"\n"$1" "$2:" "$2;prev=$1}' | awk 'NR!=1'
A1-2:
cat data1 | sort -k1,1 | awk 'BEGIN{ORS=""}{print $1!=prev?"],"$1":["$2:","$2;prev=$1}END{print "]}\n"}' | sed 's/^],/{/'
@mikkun
mikkun / KEIKYU_VVVF.pde
Created May 11, 2015 09:50
「ドレミファインバータ」なメロディーが鳴るProcessingのサンプルコード
/**
* 「上田ブログ」(http://blog.ueda.asia/)のエントリー
* 『京急VVVF音(ドレミファインバータ)の周波数』
* (http://blog.ueda.asia/?p=6039)をProcessingで鳴らしてみる
*/
import ddf.minim.*;
import ddf.minim.ugens.*;
Minim minim;
@mikkun
mikkun / tirashi_kakunin
Created April 24, 2015 09:45
サミットストア荏原4丁目店のWebページが更新されているか30分毎に確認するシェル芸(GNOME・Xfce用) ※試作版です
URI='http://www.summitstore.co.jp/tirashi/doc/435a.html?1'; chkmd5(){ wget -q -rl1 -nd -P img -A html,gif,jpg "$URI"; find img -type f | sort -n | xargs md5sum; }; while :; do [ "_$(diff <(chkmd5) <(sleep 30m; chkmd5))" = "_" ] || notify-send -i info "更新あり: サミットストア荏原4丁目店"; done
@mikkun
mikkun / 2015NewYearsHolidayArtsOfShellOneLiners.txt
Last active August 29, 2015 14:12
上田ブログ「【問題】年末年始シェル芸問題集」解答例
2014/12/30「年末年始シェル芸問題集」の解答例
問題URL: http://blog.ueda.asia/?p=4852
A1:
find ~/ -type f -a \( -iname '*.jpg' -o -iname '*.jpeg' \) -print0 | xargs -0 md5sum | sort -k1d | awk '{if($1==M){print M,P"\n"$1,$2}{M=$1;P=$2}}' | uniq
A2:
curl -s 'http://www.geocoding.jp/api/?q=羽田空港' | grep '^<\(lat\|lng\)_' | sed 's/<[^>]\+>//g' | awk -F',' '{print "緯度:"$1"度"$2"分"$3"秒"}' | sed '2s/^緯/経/'