Skip to content

Instantly share code, notes, and snippets.

View outsideris's full-sized avatar

Outsider outsideris

View GitHub Profile
@outsideris
outsideris / gist:2623342
Created May 6, 2012 17:12
repeatly exec
watch -n 1 "COMMAND"
@outsideris
outsideris / LasMultiMap.scala
Created May 13, 2012 06:58
implement multimap in scala
package pis.chap22.multimap
import scala.collection.immutable.HashMap
class LasMultiMap[A, B] {
var mmap = new HashMap[A, List[B]]
def put(key:A, value:B) = {
if (mmap.contains(key)) {
mmap = mmap + ( (key, mmap.get(key).toList(0) ::: List(value) ))
} else {
mmap = mmap + ( (key, List(value)) )
@outsideris
outsideris / etckeeper.sh
Last active October 5, 2015 10:18
using etckeeper
$ sudo apt-get install git-core etckeeper
#configure git
# edit /etc/etckeeper/etckeeper.conf
$ sudo etckeeper init
$ sudo etckeeper commit “Initial Commit”
$ cd /etc
$ sudo git status
@outsideris
outsideris / compile-nginx.sh
Last active October 5, 2015 10:18
compiling nginx
$ sudo apt-get install gcc
# or build-essential
$ sudo apt-get install libpcre3 libpcre3-dev
$ sudo apt-get install zlib1g zlib1g-dev
$ sudo apt-get install libssl-dev
$ ./configure --prefix=/usr/local/lib/nginx/nginx-1.2.0 \
@outsideris
outsideris / node-benchmark.sh
Created June 12, 2012 16:47
node.js benchmark step by ry
# https://github.com/joyent/node/issues/3383#issuecomment-6242862
% git clone git://github.com/joyent/node.git node
% cd node
% ./configure && make
% cp out/Release/node /tmp/node-master
% git checkout origin/v0.6
% rm -rf out && ./configure && make
% cp out/Release/node /tmp/node-v0.6
% PORT=6000 /tmp/node-v0.6 benchmark/http_simple.js &
@outsideris
outsideris / find.sh
Last active October 6, 2015 07:37
find command
$ find . -mtime +10 \
-name "title"
-regex "REGEXP"
-type f \
! -iname "*.temp" \
! -iname "*.pid" \
-exec rm -f {} \;
$ grep -r YOURSTRING *
@outsideris
outsideris / luhn.js
Created July 2, 2012 00:16
Luhn algorithm
module.exports = {
stepOne: function(cardNo) {
return cardNo
.split('')
.reverse()
.map(function(v, i) {
if (i%2 === 1) {
return v * 2;
} else {
return v;
@outsideris
outsideris / nodeconf_2012.md
Created July 4, 2012 16:21
a list of slides from nodeconf 2012
@outsideris
outsideris / command.sh
Last active October 7, 2015 02:18
useful unix command
# OS 버전확인
$ lsb_release -a
$ uname -a
# CPU 갯수 확인
$ cat /proc/cpuinfo | grep processor | wc -l
# 사용자 추가
$ adduser USERNAME
@outsideris
outsideris / bash_completion.sh
Created December 18, 2012 06:41
bash completion example for user command
# bash_completion
_instance()
{
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
opts="CANDIDATE1 CANDIDATE2 CANDIDATE3 CANDIDATE4 ..."
if [[ ${cur} == * ]] ; then