Collection of lightweight, quick and clean tools, configuration, etc that might otherwise make good gists.
Emphasis is on simplicity: few dependencies, easy-to-read, canonical examples.
simple_aws.rb - provides mechanism for signing HTTP requests
to AWS without needing the aws-sdk
gem. Designed for copy/paste to be
embedded directly. Examples for several common S3
operations included.
xkcd_pw.rb - Inspired by https://xkcd.com/936/ - generates a passphrase using N (default=4) random, common English words.
vms/ - Useful scripts and notes for working with QEMU VMs, especially if you want to enable PCI passthrough.
baseline - A well-tested and well-documented single-script, dependency-free baseline testing tool.
javascript - Quick references for several JavaScript actions, usage patterns, and library usage.
http_client.rb - Minimal, portable, pure-Ruby HTTP client for core HTTP actions.
Usage example:
require 'http_client.rb'
client = HttpClient.new('http://localhost:9292')
# simple GET
response = client.get('/')
# simple POST
headers = {'Content-Type' => 'application/x-www-form-urlencoded'}
body = URI.encode_www_form('key' => 'value')
response = client.post('/dest', headers, body)
# simple PUT
headers = {'Content-Type' => 'application/json'}
body = '{"key":"value"}'
response = client.put('/dest', headers, body)
# simple DELETE
response = client.delete('/dest')
# All supported HTTP actions return a Net::HTTP object that has detailed
# information about the response. Examples include:
# response content: response.body
# response HTTP code: response.code
# response status message: response.message
# response headers: response.each { |header_name, values| ... }
These serve files over HTTP from the current directory. In these examples,
replace 8080
with the desired port to serve on a different port.
Python:
python -m SimpleHTTPServer 8080
Ruby:
ruby -e "require 'webrick'; WEBrick::HTTPServer.new(DocumentRoot: '.', BindAddress: '127.0.0.1', Port: 8080).start"
.vimrc - An example .vimrc
file used for personal development
.gitignore_global - My global .gitignore
file. Drop
into your home directory and add to your global git settings with:
git config --global core.excludesfile ~/.gitignore_global
This is a good way to add editor-specific temp files that don't belong in
individual projects (so you don't have to fill every project's .gitignore
file with every possible editor's temporary files).
Added to ~/.bash_aliases
(included via ~/.bashrc
)
vg
: alias vg='valgrind --tool=memcheck --leak-check=yes --show-reachable=yes --track-origins=yes'
gitup
: used for updating branch state (eg: gitup master
) from within a repo.
function gitup() {
if [ $1 ]
then
echo "# git checkout ${1}"
git checkout $1
echo "# git pull upstream ${1}"
git pull upstream $1
echo "# git push"
git push
echo "# git fetch -p"
git fetch -p
fi
}