Skip to content

Instantly share code, notes, and snippets.

View redism's full-sized avatar

Jeff Oh redism

View GitHub Profile
@redism
redism / .gitignore
Last active April 5, 2018 01:19
general gitignore #pin
# OS generated files
.DS_Store
.DS_Store?
ehthumbs.db
Icon?
Thumbs.db
# XCode 4
*.xcuserstate
*.pbxuser
@redism
redism / static file serving with express.js
Created December 12, 2013 05:20
아주 단순한 이미지 하나 (static contents)에 대한 퍼포먼스 테스트 express.js vs nginx
[-:] redism@~: ab -n 10000 -c 10 http://127.0.0.1:2131/files/5b68e493-5055-47b3-91e4-ea11c4cd180c.jpg
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
@redism
redism / (10000-10) 1 express.js
Last active December 31, 2015 02:49
단순 GET api call 에 대한 퍼포먼스 테스트 express.js vs nginx+express.js 머신 정보 iMac13.2 4 cores
[-:] redism@~: ab -n 10000 -c 10 http://127.0.0.1:2131/api/user/1
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Finished 10000 requests
Server Software:
@redism
redism / client.js
Created April 25, 2014 09:41
Simple socket.io server performance test
/**
* A simple socket.io client for performance benchmark
*
* Created by redism on 2014. 4. 22..
*/
var SocketIO = require('socket.io-client'),
argv = require('optimist').argv;
var n = argv.n || 10;
@redism
redism / factory.js
Created January 23, 2015 12:27
Javascript new with apply
var Adder = function Adder() {
console.log(arguments);
this.list = Array.prototype.slice.apply(arguments);
};
Adder.prototype.sum = function sum() {
var sum = 0;
this.list.forEach(function(x) {
sum += x;
@redism
redism / code.gs
Created April 24, 2016 08:30
Google script custom functions for KRW
function pad0(num) {
return num < 10 ? '0' + num.toString() : num.toString();
}
function getDateStringDaysAgo(days) {
const date = new Date(Date.now() - (days * 24 * 60 * 60 * 1000));
return date.getFullYear() + "-" + pad0(date.getMonth() + 1) + "-" + pad0(date.getDate());
}
/**
@redism
redism / kr_won_to_backquote.sh
Created April 26, 2017 16:20
macOS Sierra에서 원화(₩) 대신 백 쿼트(`) 입력하기
#!/bin/bash
if [ -f ~/Library/KeyBindings/DefaultkeyBinding.dict ]; then
echo "~/Library/KeyBindings/DefaultkeyBinding.dict already exists"
exit -1
fi
mkdir -p ~/Library/KeyBindings
cat << EOF > ~/Library/KeyBindings/DefaultkeyBinding.dict
{
"₩" = ("insertText:", "\`");
@redism
redism / send
Created January 19, 2018 03:36
Sending simple push to your device after long-running process
BODY=${1:-"Finished"}
DATA='{"title":"Done","type":"note","body":"'$BODY'"}'
curl --header 'Access-Token: <YOUR_TOKEN_HERE>' \
--header 'Content-Type: application/json' \
--data-binary $DATA \
--silent \
--request POST \
https://api.pushbullet.com/v2/pushes > /dev/null