Skip to content

Instantly share code, notes, and snippets.

@goonoo
goonoo / trello_timer.user.js
Created September 30, 2014 06:57
Trello를 이용한 Standing Meeting을 위한 Timer
// ==UserScript==
// @name Trello Timer
// @namespace http://blmarket.net/users
// @description Display open time for each cards
// @include https://trello.com/board/*
// @include https://trello.com/b/*
// @version 1
// @grant none
// ==/UserScript==
@goonoo
goonoo / aes256.coffee
Last active August 29, 2015 14:12
Performance test between RC4 and AES128 and AES256
crypto = require('crypto')
cipher_key = "awegohaewiot2#%@#A#()GAWJVZDz34t#$TJOP#A$TA"
cipher = (txt) ->
c = crypto.createCipher('aes-256-cbc', cipher_key)
crypted = c.update(txt, 'utf8', 'hex')
crypted += c.final('hex')
return crypted
@goonoo
goonoo / ec2-buildimage.sh
Last active August 29, 2015 14:13
EC2 Build Image script
#!/bin/bash
PATH=path/to/images
IMAGE=Image-`date +%Y%m%d-%H%M`
AWS_ACCESS_KEY=AGWEGAWEGAWEGAWEG
AWS_SECRET_KEY=waWG#reH5452HE23raWy432%
echo "building image ${IMAGE}"
sudo ec2-bundle-vol -k /home/ubuntu/.ssh/id_rsa -c /home/ubuntu/keys/server.crt -u USER_ID -r x86_64 --no-filter
@goonoo
goonoo / elevator.js
Created January 24, 2015 10:17
My Elevator Saga solution
{
init: function(elevators, floors) {
var MAX_LOAD = 4, elevatorSize = elevators.length;
var fetchElevator = function (floor, callback) {
var candidateIdx = -1, candidateDiff = elevatorSize + 1, candidateLoadFactor = .4;
var currf, fdiff;
for (var i = 0; i < elevatorSize; i++) {
currf = elevators[i].currentFloor();
fdiff = Math.abs(currf - floor.floorNum());
if (elevators[i].destinationQueue.length === 0 &&
sudo netstat -nltp | grep 4000
@goonoo
goonoo / memorymonitor.config
Last active August 29, 2015 14:27
Elastic Beanstalk Memory Monitor Config
packages:
yum:
perl-DateTime: []
perl-Sys-Syslog: []
perl-LWP-Protocol-https: []
perl-core: []
perl-Switch: []
perl-URI: []
perl-Bundle-LWP: []
@goonoo
goonoo / country_phone_codes.json
Last active August 29, 2015 14:27
Phone codes for all countries
{
"BD": "880",
"BE": "32",
"BF": "226",
"BG": "359",
"BA": "387",
"BB": "+1-246",
"WF": "681",
"BL": "590",
"BM": "+1-441",
@goonoo
goonoo / promise1.js
Last active August 25, 2016 04:10
ES6 promise best practices
// 함수 호출 타이밍에 조건에 따라 promise 실행 분기
// val1 == true, val3 == true인 경우: method1 -> method2 -> method3true
// val2 == true, val3 == false인 경우: method1 -> method2 -> method3false
// val1 == false, val3 == true인 경우: method2 -> method3true
// val2 == false, val3 == false인 경우: method2 -> method3false
function run(val1, val3) {
const p = Promise.resolve(null);
if (val1 === true)
p = p.then(method1);
p = p.then(method2);
@goonoo
goonoo / tip.vim
Created September 6, 2016 01:56
vim command tips
"모든 숫자 1씩 더하기
:%s/\[\zs\d\+\ze\]/\=(submatch(0)+1)
@goonoo
goonoo / npm_uninstall.sh
Created September 20, 2016 02:24
remove all node modules
npm uninstall `ls -1 node_modules | tr '/\n' ' '`