Skip to content

Instantly share code, notes, and snippets.

View munky69rock's full-sized avatar
:octocat:
Colla(コラ) というサービスを開発してます

Masayuki Uehara munky69rock

:octocat:
Colla(コラ) というサービスを開発してます
View GitHub Profile
#!/bin/bash
set -ue
target_dir="__TARGET_DIR__"
backup_dir="__BACKUP_DIR__"
date=$(date +%Y%m%d)
idx=0
@munky69rock
munky69rock / langton_ant.haml
Last active December 23, 2015 06:09
Langton's Ant
!!! 5
%meta(charset="utf-8")
%title Langton's Ant
:coffeescript
#
# original: http://ottati.hatenablog.com/entry/2013/09/16/122423
# rewrite and customize with haml & coffee-script
# demo: http://jsdo.it/munky69rock/a3Zl
#
#!/bin/sh
pbpaste | sort | uniq | pbcopy
@munky69rock
munky69rock / get_cpu_core_num.sh
Created June 7, 2013 09:27
CPUコア数の取得
#!/bin/sh
# cf:http://www.songmu.jp/riji/archives/2013/06/worker.html
getconf _NPROCESSORS_ONLN
@munky69rock
munky69rock / 2013-02-22.md
Last active December 14, 2015 02:08
2013/02/22

今週のTips

  • shellで演算する

      echo $((3600*24*3)) # -> 259200
    
  • 実機でJSデバッグする

漢のJavaScript (サーバーサイド編)

@munky69rock
munky69rock / perldoc.sh
Created February 22, 2013 03:25
perldocをutf-8にして出力させる
#!/bin/sh
SHELL=/bin/bash /usr/bin/perldoc -n 'nkf -w | nroff' "$@"
@munky69rock
munky69rock / html2haml.sh
Last active December 12, 2015 00:09
convert html to haml
#!/bin/sh
# http://html2haml.heroku.com/
set -ue
if [ $# -ne 1 -o ! -e "$1" ]; then
echo "Usage: $0 [path] ";
exit
fi
@munky69rock
munky69rock / fix_ubuntu_utf8_locale.sh
Created January 28, 2013 03:19
[ubuntu][utf-8]localeエラーが発生した場合の修正方法
# [bash: warning: setlocale: LC_ALL: cannot change locale]
sudo locale-gen ja_JP
sudo update-locale LANG=ja_JP.UTF-8
@munky69rock
munky69rock / check-url-scheme.js
Created January 18, 2013 07:02
iPhone Safari: check if URL scheme is supported in javascript
// cf: http://stackoverflow.com/questions/627916/iphone-safari-check-if-url-scheme-is-supported-in-javascript
function checkUrlScheme(app_url_scheme, app_install_url, app_name) {
document.location = app_url_scheme;
setTimeout(function() {
if(confirm('You do not seem to have '+app_name+' installed, do you want to go download it now?')){
document.location = app_install_url;
}
}, 300);
}
@munky69rock
munky69rock / vim-pager.sh
Created December 19, 2012 04:41
vim pager
#!/bin/sh -u
set -e
# origin: http://www.songmu.jp/riji/archives/2012/05/post_379.html
# check: http://d.hatena.ne.jp/masudaK/20120223/1330006586
if [[ -p /dev/stdin ]];then
tr -d "\r" | vim -R -
else