I hereby claim:
- I am tywong on github.
- I am molewong (https://keybase.io/molewong) on keybase.
- I have a public key ASA3ZdHpElsRf7sO4ZMx3G9IrElyMTRTfm0H0JtYENo3igo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
var params = { | |
Records: [ /* required */ | |
{ | |
Data: new Buffer('...') || 'STRING_VALUE', /* required */ | |
PartitionKey: 'STRING_VALUE', /* required */ | |
ExplicitHashKey: 'STRING_VALUE' | |
}, | |
/* more items */ | |
], | |
StreamName: 'STRING_VALUE' /* required */ |
function DBPool() { | |
let constants = require('./constants.json'); | |
return mysql.createPool({ | |
"host": constants.SC_DB_HOST, | |
"user": constants.SC_DB_USER, | |
"password": constants.SC_DB_PASSWORD, | |
"database": constants.SC_DB_NAME | |
}); | |
} |
const Promise = require('bluebird'); | |
let array = [ | |
10, 10, 10, 10, 10, 10 | |
]; | |
return Promise.reduce(array, | |
(total, key, idx) => { | |
console.log(idx); | |
if(total == 20) |
const spawn = require('child-process-promise').spawn; | |
function convert(conf) { | |
let promise = spawn('convert', conf.cmd); | |
let proc = promise.childProcess; | |
let total = []; | |
proc.stdin.write(conf.bgImageStream); | |
proc.stdin.end(); |
let LOG_FILE = parseInt((new Date()).getTime() / 1000); | |
let winston = require('winston'); | |
winston.remove(winston.transports.Console); | |
winston.add(winston.transports.File, { | |
"name": "debug-log", | |
"json": false, | |
"filename": `log/${LOG_FILE}-debug.log`, | |
"level": "debug" |
function timeout(sec) { | |
if(sec == 0) | |
return Promise.resolve(); | |
return new Promise( | |
(fulfill, reject) => { | |
setTimeout( | |
() => fulfill(Promise.resolve()), | |
sec * 1000 | |
) | |
} |
var Promise = require('bluebird'); | |
var request = require("request-promise"); | |
//////////////////////////////////////////// | |
function requestWithRetry(param, maxRetry) { | |
//////// Inner function //////// | |
function retryBlock(iter, timeout) { |
#include <stdio.h> | |
int count = 0; | |
void subset_sum(int k, int n, int r) { | |
if(n < 0) | |
return; | |
if(r == 0 && n == 0) { | |
count++; | |
return; |
#include <stdio.h> | |
#include <string.h> | |
void print_result(int result[], int len) { | |
int i; | |
if(len == 0) | |
printf("NOTHING\n"); | |
else { | |
for(i = 0; i < len; i++) | |
printf("%d ", result[i]); |