Skip to content

Instantly share code, notes, and snippets.

@james-huston
james-huston / compile_couchdb
Last active March 26, 2025 17:46
Build and install couchdb on a new EC2 instance
#!/bin/bash
# very helpful page for getting this going
# http://www.everyhaironyourhead.com/installing-couchdb-1-5-on-amazon-linux/
#enable epel repo first yo!
sudo yum install gcc gcc-c++ libtool libicu-devel openssl-devel autoconf-archive erlang python27 python-sphinx help2man js-devel
# install spidermonkey from mozilla for faster version
# we skipp this since I couldn't get couch to work. need to revisit
#!/bin/bash
# this needs to run inside of npm/npm-registry-couchapp
# https://github.com/npm/npm-registry-couchapp
HOST=http://localhost:5984
USER=npm
PASS=yourmomma
FULLHOST=http://$USER:$PASS@localhost:5984
@james-huston
james-huston / logrotate.conf
Last active August 29, 2015 14:05
logrotate for an app under messages
/var/log/appname/*.log {
compress
copytruncate
daily
rotate 3
size 10M
}
@james-huston
james-huston / logger.go
Created September 2, 2014 13:25
Debugging errors
func (w *Worker) LogFailedMessage(msg *nsq.Message) {
log.Debug("❨╯°□°❩╯︵ %s", msg.Body)
}
@james-huston
james-huston / export.js
Created September 15, 2014 17:25
Easy to read amd/commonjs/window export
var MyModule = {};
// AMD support
if (typeof define === 'function' && define.amd) {
define(function () { return MyModule});
// CommonJS and Node.js module support.
} else if (typeof exports !== 'undefined') {
// Support Node.js specific `module.exports` (which can be a function)
if (typeof module !== 'undefined' && module.exports) {
exports = module.exports = MyModule;
@james-huston
james-huston / test.js
Created October 23, 2014 22:10
nsqd simple example
var nsq = require('nsq.js');
var reader = nsq.reader({
// nsqlookupd: ['localhost:4161'],
nsqd: ['localhost:4150'],
topic: 'events',
channel: 'ingestion',
maxInFlight: 250
});
{
"requireCurlyBraces": [
// "if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
module.exports = {
'link test': function (browser) {
var linkCount = 0;
var processed = 0;
var baseUrl = 'http://www.directvdeals.com';
function processLinks(iteration) {
@james-huston
james-huston / haproxy.conf
Created December 23, 2014 18:03
haproxy.conf polling and sockets with sticky sessions using url param
global
maxconn 32768
quiet
# Performance turning
tune.maxaccept -1
stats socket /tmp/haproxy.sock mode 0666 level admin
log 127.0.0.1 local0 notice
log 127.0.0.1 local0 debug
@james-huston
james-huston / message.sh
Last active August 29, 2015 14:14
Generate an image with text in it to look like an sms using ImageMagick
#!/bin/bash
cat test.txt | \
convert -background '#44aff7' -fill white -size 250x5000 -trim +repage -font AvantGarde-Book -pointsize 16 caption:@- miff:- |\
#convert -background blue \
# -size $((`identify -format %w test_tmp.png` + 20))x$((`identify -format %h test_tmp.png` + 20)) \
# xc: test_tmp.png -flatten test.png
convert - -bordercolor '#44aff7' -border 10x10 test.png