Skip to content

Instantly share code, notes, and snippets.

View outsideris's full-sized avatar

Outsider outsideris

View GitHub Profile
@outsideris
outsideris / p002.scala
Last active December 16, 2015 11:09
euler for PiS Study
package kr.ne.outsider
object p002 extends App {
var cache:Map[Int, Int] = Map()
def fibonacci(x: Int): Int = {
cache.get(x) match {
case Some(t) => t
case _ => {
x match {
@outsideris
outsideris / p001.scala
Last active December 16, 2015 11:09
euler for PiS study
package kr.ne.outsider
object p001 extends App {
val source = 1 until 1000
val result = source.filter(x => x % 3 ==0 || x % 5 == 0).sum
println(result) //233168
}
@outsideris
outsideris / gist:5402097
Created April 17, 2013 06:00
jslint-report_in_grunt.js
var jshintCli = require('./node_modules/grunt-contrib-jshint/node_modules/jshint/src/cli/cli');
// ...
grunt.initConfig({
"jshint-report": {
options: {
outDir: 'build-reports'
},
all: {
@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
@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 / nodeconf_2012.md
Created July 4, 2012 16:21
a list of slides from nodeconf 2012
@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 / 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 / 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 / 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 \