start new:
tmux
start new with session name:
tmux new -s myname
// takes arguments and produces an array of functions that accept context | |
function handle_args() { | |
var args = Array.prototype.slice.call(arguments); | |
return args.map(function(arg) { | |
if(arg instanceof Function) return arg; // Presumably already a contex-accepting function. | |
if(arg instanceof Array) return and.apply(this, arg); // make arrays behave as and. | |
// Presuming a string, build a function to check. | |
var my_regex = new RegExp(arg.toString(), 'i'); | |
return function(context) { | |
return context.search(my_regex) > -1; |
box: wercker/golang | |
# Add services here | |
# Build definition | |
build: | |
# The steps that will be executed on build | |
steps: | |
# Sets the go workspace and places you package | |
# at the right place in the workspace tree | |
- setup-go-workspace |
function Promise() { | |
var callbacks = [], | |
promise = { | |
resolve: resolve, | |
reject: reject, | |
then: then, | |
safe: { | |
then: function safeThen(resolve, reject) { | |
promise.then(resolve, reject); | |
} |
#!/bin/sh | |
# OPTIONAL FLAGS: | |
# | |
# -geoip true | |
# this will install maxmind geoip and auto update crontab file | |
# | |
# -cloudwatch true | |
# this will install aws cloud watch metrics and send them to aws dashboard | |
# |
Setting up Dokku with DigitalOcean and Namecheap
..or how I made my own heroku in a few hours for $3.98.
This write-up owes a great deal to dscape's Node.js Deployments with Docker, Dokku, & Digital Ocean, the dokku project itself, and the fine folks working on dokku's issues. I took dscape's article as a starting point when trying this out but found some details lacking so I documented my own process for getting dokku up and running.
package main | |
import ( | |
"fmt" | |
"log" | |
"net" | |
"net/mail" | |
"net/smtp" | |
"crypto/tls" | |
) |
It is possible to compile Go programs for a different OS, even though go build
says otherwise.
You'll need:
golang-crosscompile
helper script https://github.com/davecheney/golang-crosscompilePID = /tmp/awesome-golang-project.pid | |
GO_FILES = $(wildcard *.go) | |
serve: | |
@make restart | |
@fswatch -o . | xargs -n1 -I{} make restart || make kill | |
kill: | |
@kill `cat $(PID)` || true |
#!/usr/bin/env bash | |
rm go-swarm.test || true | |
nohup go test -c -gcflags '-N -l' -work github.com/olebedev/go-swarm | |
WORK=$(cat nohup.out) | |
rm nohup.out | |
cgdb go-swarm.test -- -d ${WORK#WORK=} || rm go-swarm.test || true | |
# gdb --tui go-swarm.test -d ${WORK#WORK=} || rm go-swarm.test || true | |
rm go-swarm.test || true | |
echo ${WORK#WORK=} |