Skip to content

Instantly share code, notes, and snippets.

@redism
redism / .gitignore
Last active Apr 5, 2018
general gitignore #pin
View .gitignore
# 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 Dec 12, 2013
아주 단순한 이미지 하나 (static contents)에 대한 퍼포먼스 테스트 express.js vs nginx
View static file serving with express.js
[-:] 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 Dec 31, 2015
단순 GET api call 에 대한 퍼포먼스 테스트 express.js vs nginx+express.js 머신 정보 iMac13.2 4 cores
View (10000-10) 1 express.js
[-:] 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 Apr 25, 2014
Simple socket.io server performance test
View client.js
/**
* 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 Jan 23, 2015
Javascript new with apply
View factory.js
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 Apr 24, 2016
Google script custom functions for KRW
View code.gs
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 Apr 26, 2017
macOS Sierra에서 원화(₩) 대신 백 쿼트(`) 입력하기
View kr_won_to_backquote.sh
#!/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 Jan 19, 2018
Sending simple push to your device after long-running process
View send
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