Skip to content

Instantly share code, notes, and snippets.

View garrettwilkin's full-sized avatar

Garrett Wilkin garrettwilkin

View GitHub Profile
@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@antirez
antirez / lmdb.tcl
Created April 28, 2017 15:40
LMDB -- First version of Redis written in Tcl
# LVDB - LLOOGG Memory DB
# Copyriht (C) 2009 Salvatore Sanfilippo <antirez@gmail.com>
# All Rights Reserved
# TODO
# - cron with cleanup of timedout clients, automatic dump
# - the dump should use array startsearch to write it line by line
# and may just use gets to read element by element and load the whole state.
# - 'help','stopserver','saveandstopserver','save','load','reset','keys' commands.
# - ttl with milliseconds resolution 'ttl a 1000'. Check ttl in dump!
@rothgar
rothgar / main.yml
Last active March 8, 2024 07:16
Generate /etc/hosts with Ansible
# Idempotent way to build a /etc/hosts file with Ansible using your Ansible hosts inventory for a source.
# Will include all hosts the playbook is run on.
# Inspired from http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html
- name: "Build hosts file"
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present
when: hostvars[item].ansible_default_ipv4.address is defined
with_items: groups['all']
@notsle
notsle / get_public_ip.sh
Last active January 3, 2024 06:24
Get Public IP address with curl and ipchicken.com
curl -s https://ipchicken.com | egrep -o '([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3}'
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@snuggs
snuggs / .tmux.conf
Last active February 7, 2023 13:51
IDE & TMUX Configuration
############################################################################
# _
# | |_ _ __ ___ _ ___ __
# | __| '_ ` _ \| | | \ \/ /
# | |_| | | | | | |_| |> <
# \__|_| |_| |_|\__,_/_/\_\
#
# Cheatsheets:
# https://devhints.io/tmux
# `property not found` issue:
@mshkrebtan
mshkrebtan / webex-ubuntu.md
Last active October 28, 2022 15:23
Run Cisco Webex on 64-bit Ubuntu 16.04

Run Cisco Webex on 64-bit Ubuntu 16.04

With Audio and Screen Sharing Enabled

Enable support for 32-bit executables

Add the i386 architecture to the list of dpkg architectures :

sudo dpkg --add-architecture i386
@jakeemerson
jakeemerson / handy_es_queries
Last active June 23, 2022 14:25
helpful elastic search queries
## get all the pageviews on the boundary-vpc host in the last hour, sort by timestamp
curl -X GET "http://elastic-04:9200/logstash-2015.03.31/_search/?pretty" -d'
{
"query": {
"filtered": {
"query": {
"match": {"host" : "boundary-vpc"}
},
"filter": {
@jlecour
jlecour / post_to_slack.rb
Last active May 22, 2022 17:43
How to post alerts from Monit to Slack
# encoding: UTF-8
require 'optparse'
require 'net/http'
require 'json'
def parse_options(argv)
opts = {}
@parser = OptionParser.new do |o|
@bblincoe
bblincoe / client_throttle.py
Last active April 28, 2022 14:16
Amazon AWS Client Throttle in Python (boto3)
import boto3
import botocore
from random import randint
from time import sleep
def client_throttle(action, **kwargs):
while True:
try:
return action(**kwargs)
except botocore.exceptions.ClientError as e: