This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cluster = require('cluster'); | |
if (cluster.isMaster) { | |
for(var i=0; i<10; i++) | |
cluster.fork(); | |
} else { | |
setInterval(function(){ | |
console.log(process.pid); | |
}, 1000) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
BUFFER_SIZE = 256*1024 | |
url = 'http://downloads.sourceforge.net/project/pydev/pydev/PyDev%202.5.0/PyDev%202.5.0.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpydev%2Ffiles%2F&ts=1338118912&use_mirror=nchc' | |
res = urllib2.urlopen(url) | |
with open('PyDev.zip', 'wb') as f: | |
while True: | |
chunk = res.read(BUFFER_SIZE) | |
if(not chunk): | |
break | |
f.write(chunk) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re, urllib2, subprocess, zipfile, os, shutil | |
#first install wkhtmltopdf | |
tool_path = r'C:/Program Files/wkhtmltopdf/wkhtmltopdf.exe' | |
data_source = r'D:\TFS\ETTfsApp\EnglishTown\Team_ELab\Development\Source\ELab\ELab\EFSchools.Englishtown.ELab.UI\_scripts\elab-ui\library\binddataelibresults.js' | |
def process(urls): | |
for url in urls: | |
print 'processing', url | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var type = typeof(T); | |
var props = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.SetProperty); | |
var dr = Expression.Parameter(typeof(IDataReader), "dr"); | |
var result = Expression.Parameter(typeof(List<T>), "result"); | |
var resultAdd = typeof(List<T>).GetMethod("Add"); | |
var drRead = typeof(IDataReader).GetMethod("Read"); | |
var getOrdinal = typeof(IDataRecord).GetMethod("GetOrdinal"); | |
ParameterExpression[] ords = props.Select((prop, index) => Expression.Variable(typeof(int), "ord" + index)).ToArray(); | |
var itm = Expression.Parameter(type, "itm"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git daemon --reuseaddr --base-path=j:\git --export-all --verbose --enable=receive-pack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git ls-remote origin | |
git remote add qa git://qaserver/round1 | |
git fetch qa | |
git branch --track test origin/test | |
git push origin <branch name> | |
git pull origin <branch name> | |
git push origin --delete v0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MemoryCache : IObjectCache | |
{ | |
public T Get<T>(CacheKey key, DateTime absoluteExpiration, Func<T> load) | |
{ | |
var policy = new System.Runtime.Caching.CacheItemPolicy(); | |
policy.AbsoluteExpiration = absoluteExpiration; | |
return Get(key, policy, load); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var pathHelper = require('path'); | |
// var files = fs.readdirSync(pathHelper.join(__dirname, 'root')); | |
// files.forEach(function(a) { | |
// console.log(a); | |
// }); | |
// console.log(readConfig('root/a')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var map = require('map-stream'); | |
var gulp = require('gulp'); | |
var htmlsrc = require('./htmlsrc.js'); | |
gulp.task('default', function() { | |
//gulp.src('src/**/*.js') | |
// .pipe(map(function(file, next) { | |
// console.dir(file); | |
// next(null, file); | |
// })) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install webpack react reactdom babel-preset-react babel-core babel-loader | |
module.exports = { | |
entry: './app.jsx', | |
output: { | |
path: './dist', | |
filename: 'bundle.js' | |
}, | |
module: { | |
loaders: [{ | |
test: /\.jsx$/, |
OlderNewer