Skip to content

Instantly share code, notes, and snippets.

wangyangkobe /
Created Mar 2, 2017
def fabinacci(n):
x,y = 0,1
for index in range(n):
x,y = x+y, x
return x
def cache(fun):
_cache = {}
def _inner(n):
if n in _cache:
wangyangkobe / parallel_accumulate.cpp
Created Dec 15, 2016
a parallel version of std::accumulate.
View parallel_accumulate.cpp
#include <thread>
#include <iostream>
#include <memory>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
using namespace std;
template<typename Iterator, typename T>
wangyangkobe / foo.log
Created Sep 8, 2016 — forked from ibeex/foo.log
Flask logging example
View foo.log
A warning occurred (42 apples)
An error occurred
wangyangkobe / main.cpp
Created Jul 14, 2016
Akuna Capital (Shanghai) C++ Coding Challenge For Regular Program
View main.cpp
#include <iostream>
#include <fstream>
#include <stdint.h>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
#pragma pack(push)
wangyangkobe /
Created Feb 29, 2016 — forked from jamiesun/
#! /usr/bin/env python2.7
import sys
import os
import time
import atexit
from signal import SIGTERM
wangyangkobe / tcp_server.erl
Created Sep 6, 2015
The tcp server of Erlang.
View tcp_server.erl
start(Port) ->
Pid = spawn_link(fun()->
{ok, ListenSocket} = gen_tcp:listen(Port, [binary, {active, false}]),
spawn(fun() -> acceptor(ListenSocket) end),
wangyangkobe / waterline_mongo.js
Last active Aug 29, 2015
How to use waterline for MongoDB.
View waterline_mongo.js
var express = require('express');
var app = express();
var Waterline = require('waterline');
var sailsMongoAdapter = require('sails-mongo');
var orm = new Waterline();
var bodyParser = require('body-parser');
var bcrypt = require('bcrypt');
app.use(bodyParser.urlencoded({ extended: false }));
View cba_build_package
import os
from subprocess import Popen, PIPE
import traceback
import threading
import time
import sys
AIT_DIR = r"/vobs/ims/sbg/src/delivery/sgcPSR/SiteConfigurationPackage/AIT"
wangyangkobe / extract.js
Last active Aug 29, 2015
extract *.tar.gz for SBG code.
View extract.js
var path = require('path');
var fs = require('fs');
var tarball = require('tarball-extract');
var rimraf = require("rimraf");
var srcDir = "C:\\Users\\elqstux\\Desktop"
var dstDir = "C:\\Users\\elqstux\\Desktop\\SBG Code\\src";
var files = ["SOM_CRA1190221.tar.gz", "SYF_CRA1190070.tar.gz", "auto.tar.gz", "SGC_CRA1190962.tar.gz"];
wangyangkobe /
Last active Aug 29, 2015
The exercise for Pmw.EntryField.
from Tkinter import *
import time, string
import Pmw
class EntryValidation:
def __init__(self, master):
now = time.localtime(time.time())
self._date = Pmw.EntryField(master, labelpos='w', label_text='Date (mm/dd/yy):', value = "%d%d%d" % (now[1], now[2], now[0]),
validate={'validator':'date', 'format':'mdy', 'separator':'/'})