Skip to content

Instantly share code, notes, and snippets.

View duyet's full-sized avatar

duyet duyet

View GitHub Profile
/**
* Data structure and algorithm: Binary Tree
* Some action with Binary Tree
*
* Author: LvDuit (lvduit08 at gmail.com)
* Date: 16/06/2014
*/
#include <stdio.h>
#include <math.h>
lib =
fs : require('fs')
u : require('underscore')
https : require('https')
url : require('url')
appendToFile = (data) ->
lib.fs.open 'fbdata', 'a', (e, fd) ->
lib.fs.write fd, data, null, 'utf8', ->
lib.fs.close fd, ->
vector<string> answer;
void getStrings( string s, int digitsLeft )
{
if( digitsLeft == 0 ) // the length of string is n
answer.push_back( s );
else
{
getStrings( s + "0", digitsLeft - 1 );
getStrings( s + "1", digitsLeft - 1 );
@duyet
duyet / nodejs-rfid.js
Last active August 29, 2015 14:16 — forked from basham/nodejs-rfid.js
/*
DESCRIPTION
-----------
Use NodeJS to read RFID ids through the USB serial stream. Code derived from this forum:
http://groups.google.com/group/nodejs/browse_thread/thread/e2b071b6a70a6eb1/086ec7fcb5036699
CODE REPOSITORY
---------------
https://gist.github.com/806605
@duyet
duyet / 0_reuse_code.js
Last active August 29, 2015 14:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@duyet
duyet / git-pull-force.sh
Last active August 29, 2015 14:18 — forked from vladimirtsyupko/gist:10964772
Git force pull to overwrite local files
git fetch --all
git reset --hard origin/master
git pull origin master
#! /bin/sh
usage_error () {
echo 'Usage: sh migrator.sh <path to sqlite_to_postgres.py> <path to sqlite db file> <an empty dir to output dump files>'
echo
echo 'Example:'
echo '>sh migrator.sh sqlite_to_postgres.py ~/reviewboard.db /tmp/dumps'
echo
echo 'Tested on:'
echo 'Python 2.7.3'

Gitlab Gmail configuration

In Gitlab 2.6 you must edit the following files in order to send messages through a Gmail account (also applicable to Google Apps accounts).

config/environments/production.rb

config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
var RTBkit = require('../build/x86_64/bin/rtb.node');
var services = require('../build/x86_64/bin/services.node');
var zookeeperUri = "localhost:2181"; //must point to same Zookeeper as routers
var services = new services.ServiceProxies();
services.bootstrap('bootstrap.json');
var agent = new RTBkit.BiddingAgent('myAgent', services);