Skip to content

Instantly share code, notes, and snippets.

View timhudson's full-sized avatar

Tim Hudson timhudson

View GitHub Profile
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://raw.github.com/gist/2776679/04ca3bbb9f085b192f6aca945120fe12d59f15f9/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"
{
"Statement": [
{
"Effect": "Allow",
"Action": "S3:*",
"Resource": "arn:aws:s3:::foo/*",
"Condition": {}
},
{
"Effect": "Allow",
var _ = require('highland'),
redis = require('redis'),
client = redis.createClient();
var pattern = process.argv[2],
count = process.argv[3] || 10
client.on('error', function(err) {
throw err
});
dataStream.pipe(reactStream).pipe(dataStream)
@timhudson
timhudson / app.js
Created June 14, 2014 03:09
React write stream thoughts
var ObserveStream = require('observ-stream')
var ReactWriteStream = require('react-write-stream')
var state = require('./state')
var Row = require('./row')
ObserveStream(state)
.pipe(ReactWriteStream(Row, document.getElementById('example'))
setInterval(function() {
state.age.set(state.age()++)
var fs = require('fs')
var benchmark = require('benchmark')
var suite = new benchmark.Suite()
var xmlNodes = require('../index.js') // xml-nodes/buffers
var xmlNodesStr = require('../index-str.js') // xml-nodes/master
// start benchmarking
suite
.add('buffers', {
'defer' : true,
{
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night-Eighties.tmTheme",
"create_window_at_startup": false,
"font_face": "Droid Sans Mono",
"font_size": 19.0,
"highlight_line": true,
"remember_full_screen": true,
"scroll_past_end": true,
@timhudson
timhudson / json-object-write-stream.js
Last active August 29, 2015 14:20
json-object-write-stream
var jsonStream = jsonObjectWriteStream()
fs.createReadStream(‘path/to/description’)
.pipe(jsonStream.createAttributeWriteStream(’description’))
jsonStream.pipe(process.stdout)
// {“description”: “whatever was inside the path/to/description file”}
@timhudson
timhudson / index.js
Last active August 29, 2015 14:21
gzip dropped file
var dragDrop = require('drag-drop')
var createReadStream = require('filereader-stream')
var zlib = require('zlib')
dragDrop('#dropTarget', function (files, pos) {
createReadStream(files[0])
.pipe(zlib.createGzip())
.on('data', function (data) {
console.log(data)
})
@timhudson
timhudson / While.java
Last active August 29, 2015 14:21
Super unscientific benchmark of while loops in Java and JavaScript
public class While {
private static final long iterations = 1000000000;
private static long count = 0;
public static void main(String[] args) {
long start = System.currentTimeMillis();
while (count < iterations * 10) {
count++;
}