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
// https://github.com/cmawhorter/hmmac/issues/10 | |
var app = require('express')(); | |
var Hmmac = require('hmmac'); | |
var AWS = require('aws-sdk'); | |
var accessKeyId = 's3box'; | |
var secretAccessKey = 's3box'; | |
var hmmac = new Hmmac({ |
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 crypto = require('crypto'); | |
var ALGO = 'sha256'; | |
function hashValue(val) { | |
var hash = crypto.createHash(ALGO) | |
, target; | |
switch (toString.call(val)) { | |
case '[object Object]': | |
target = hashObject(val); |
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
// This loads large-ish new line separated JSON files into memory. If you need truly large file support | |
// and getting errors, you might want to google nodejs v8 heap limit or something. | |
// I believe it's the --max-old-space-size option in particular. | |
// Another script I wrote generated the JSON files in this | |
// format, so this script matches the format. | |
// File Lines: | |
// 1. [ | |
// 2. null | |
// 3. , { some: 'object', data: 'here' } |
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
process.title = 'node http-proxy'; | |
var CONCURRENCY = 250; | |
var assert = require('assert') | |
, crypto = require('crypto') | |
, http = require('http'); | |
http.globalAgent.maxSockets = Infinity; |
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
// If you're supporting an app built with GWT and running into Invalid Character errors | |
// in older version of IE, this patch should fix it with no GWT code changes. | |
// | |
// Just include thes script before before including your gwt <script src="app.nocache.js"> | |
// | |
// Yay. GWT magically working again. | |
// NOTE: Does a console.warn "Init document.createElement interception..." prior to running. | |
// NOTE: If the patch ever encounters an error it will fall back to the native browser |
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
#!/usr/bin/env bash | |
# usage: `spc` or `spc [number of lines]` | |
lines=${1:-30} | |
for ((i=1; i<=$lines; i++)) | |
do | |
echo | |
done |
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
#!/bin/sh | |
# | |
# redis - this script starts and stops the redis-server daemon | |
# | |
# chkconfig: - 85 15 | |
# description: Redis is a persistent key-value database | |
# processname: redis-server | |
# config: /etc/redis/redis.conf | |
# config: /etc/sysconfig/redis | |
# pidfile: /var/run/redis.pid |
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
# Redis configuration file example | |
# Note on units: when memory size is needed, it is possible to specify | |
# it in the usual form of 1k 5GB 4M and so forth: | |
# | |
# 1k => 1000 bytes | |
# 1kb => 1024 bytes | |
# 1m => 1000000 bytes | |
# 1mb => 1024*1024 bytes | |
# 1g => 1000000000 bytes |
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
// similar usecase; abbreviated | |
var myTask = function(callback) { | |
var state = { response: false, body: false, other: null }; // only t/f factored when enableNulls | |
var abortWait = waitForState(state, callback); // returns function to abort with error | |
var req = request('https://...'); | |
req.on('response', function(res) { | |
asyncLogResponse(function(err) { | |
if (err) return abortWait(err); // aborts wait and callbacks immediately | |
state.response = true; |
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
// just a control; doesn't matter specifics | |
exports.handler = function(event, context) { | |
console.log('starting'); | |
setTimeout(function() { | |
console.log('done'); | |
context.succeed(); | |
}, 1000); | |
}; |