Skip to content

Instantly share code, notes, and snippets.

@kylelemons
kylelemons / stackerror.go
Created June 20, 2014 23:03
This is a playground paste that demonstrates extracting the caller and call for error messages
package main
import (
"fmt"
"log"
"path/filepath"
"runtime"
"strings"
"unicode"
)
@kylelemons
kylelemons / .tmux.conf
Last active August 29, 2015 14:12
TMux Config
#
# General settings
#
# Set terminal titles
set -g set-titles on
# Expect UTF-8
set -g utf8 on
@kylelemons
kylelemons / container.sh
Last active August 29, 2015 14:17
Generic container management script
#!/bin/bash
# Always run from the script local directory:
cd "$(dirname "${BASH_SOURCE[0]}")"
# Constants:
IMAGE="yourprefix/imagename"
CONTAINER="containername"
# Configuration variables:
@kylelemons
kylelemons / frontend-controller.yaml
Created April 5, 2015 00:27
Frontend ReplicationController config
id: frontend
kind: ReplicationController
apiVersion: v1beta1
labels:
app: frontend
desiredState:
replicas: 1
replicaSelector:
app: frontend
podTemplate:
@kylelemons
kylelemons / ghost-service.yaml
Last active August 29, 2015 14:18
Kubernetes service descriptions for Ghost
id: ghost
kind: Service
apiVersion: v1beta1
selector:
app: ghost
labels:
app: ghost
containerPort: 2368
port: 2368
@kylelemons
kylelemons / frontend-service.yaml
Last active August 29, 2015 14:18
Frontend service description for Kubernetes
id: frontend
kind: Service
apiVersion: v1beta1
selector:
app: frontend
labels:
app: frontend
containerPort: 80
port: 80
publicIPs:
package b62
import (
"math"
"testing"
)
const alphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
func base62EncodeB(num int) []byte {
package main
import (
"fmt"
)
type myInt int
func (i myInt) square() myInt {
return i*i
func CriticalDataManager(cmdchan chan CriticalCommand) {
queued := new(vector.Vector)
critical := 0
for {
var rawcmd CriticalCommand
if critical == 0 && queued.Len() > 0 {
// Process the queued-up commands when we aren't in critical section
rawcmd := queued.At(0)
queued.Delete(0)
} else {
==> ./sub/ctpkg.c <==
#include <stdio.h>
void PrintIt() {
printf("PASS\n");
}
==> ./sub/cgotpkg.go <==
package tpkg