Skip to content

Instantly share code, notes, and snippets.

@tigris
tigris / chef_solo_bootstrap.sh
Created April 30, 2012 02:16 — forked from ryanb/chef_solo_bootstrap.sh
Bootstrap Chef Solo + Git
#!/usr/bin/env bash
GITHUB_USER="tigris"
GITHUB_PROJECT=...
GIT_BRANCH="master"
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libyaml-dev libreadline-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
tar -xvzf ruby-1.9.3-p194.tar.gz
@skelterjohn
skelterjohn / gist:3743756
Created September 18, 2012 15:27
Code and example for LimitBuffer
// code for http://gowithconfidence.tumblr.com/post/31797884887/limit-buffers
package main
import (
"bytes"
"errors"
"fmt"
"io"
"sync"
@icholy
icholy / gobreak.sh
Last active December 16, 2015 19:18
Shell script to simplify setting GDB breakpoints
# Demo http://ascii.io/a/3019
# build
gdbb () {
# build with debug flags
go build -gcflags "-N -l" -o out
# make sure the build didn't fail
if [ $? != 0 ]; then return; fi
show_icons() {
defaults write com.apple.finder CreateDesktop true
killall Finder
}
hide_icons() {
defaults write com.apple.finder CreateDesktop false
killall Finder
}
This diff is a modified version of a diff written by Arnis Lapsa.
[ The original can be found here: https://gist.github.com/ArnisL/6156593 ]
This diff adds support to tmux for 24-bit color CSI SRG sequences. This
allows terminal based programs that take advantage of it (e.g., vim or
emacs with https://gist.github.com/choppsv1/73d51cedd3e8ec72e1c1 patch)
to display 16 million colors while running in tmux.
The primary change I made was to support ":" as a delimeter as well
@dkubb
dkubb / ev.rb
Created March 16, 2011 22:13
Poor-man's Embedded Value
class User
include DataMapper::Resource
property :id, Serial
property :username, String, :required => true, :unique => true
property :address_street_address, String
property :address_location, String
property :address_subdivision, String
property :address_country, String
@husobee
husobee / validation-main.go
Created January 8, 2016 20:07
input validation sanely
package main
import (
"encoding/json"
"errors"
"net/http"
"github.com/asaskevich/govalidator"
)
package main
import "fmt"
// WithPrefix
type prefixOption struct{}
func WithPrefix() interface {
GetOption
@bketelsen
bketelsen / cleanup.sh
Created July 4, 2021 12:43
cleanup detritus from dev work
│ File: .zsh/includes/cleanup.sh
───────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ cleanup () {
2 │ find ~/src -name 'node_modules' -type d -prune -exec rm -rf '{}' +
3 │ find ~/src -name '.next' -type d -prune -exec rm -rf '{}' +
4 │ cargo sweep -r -t 30 ~/src
5 │ brew cleanup
6 │ is_bin_in_path docker && docker system prune -a -f --volumes || echo "skipping docker"
7 │ }
8 │ # https://stackoverflow.com/questions/6569478/detect-if-executable-file-is-on-users-path
@tux21b
tux21b / disruptor.go
Created September 15, 2011 02:22
Disruptor
// Copyright (C) 2011 by Christoph Hack. All rights reserved.
// Use of this source code is governed by the New BSD License.
/*
This program contains a simple micro-benchmark for a Disruptor [1] like
event buffer (or at least what I think that Disruptor might be). There
isn't any kind of API yet and this test is currently limited to a
single producer - single consumer architecture, but generally the
architecture of Disruptor is also well suited for multiple producers and
consumers.