Skip to content

Instantly share code, notes, and snippets.

@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active April 24, 2025 05:26
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1
@steveklabnik
steveklabnik / Gemfile
Created July 24, 2012 21:52
Hypermedia Proxy pattern in JSON
source :rubygems
gem 'sinatra'
@pdarche
pdarche / open paths oauth2 sinatra implementation
Created July 28, 2012 20:27
This is a Sinatra route that handles authentication and access to the open paths api using the oauth2 gem
get '/op' do
consumer_key = 'key'
consumer_secret = 'secret'
url = 'https://openpaths.cc/'
now = Time.now
#instantiate client
client = OAuth2::Client.new(consumer_key, consumer_secret, :site => url)
#create token
@joho
joho / gist:3735740
Created September 17, 2012 05:40 — forked from rafaelss/gist:3700977
PostgreSQL 9.2 upgrade steps
Steps to install and run PostgreSQL 9.2 using Homebrew (Mac OS X)
(if you aren't using version 9.1.5, change line 6 with the correct version)
1. launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
2. mv /usr/local/var/postgres /usr/local/var/postgres91
3. brew update
4. brew upgrade postgresql
5. initdb /usr/local/var/postgres -E utf8
6. pg_upgrade -b /usr/local/Cellar/postgresql/9.1.5/bin -B /usr/local/Cellar/postgresql/9.2.0/bin -d /usr/local/var/postgres91 -D /usr/local/var/postgres
7. cp /usr/local/Cellar/postgresql/9.2.0/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
@nikcub
nikcub / README.md
Created October 4, 2012 13:06
Facebook PHP Source Code from August 2007
@stilist
stilist / .bash_profile
Last active October 13, 2015 10:08
Bash stuff!
export EDITOR=nano
# http://git-blame.blogspot.com/2012/02/anticipating-git-1710.html
export GIT_MERGE_AUTOEDIT=no
export CC=clang
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
###############################################################################
@stilist
stilist / .bash_profile
Last active October 13, 2015 12:58
Natural-language git commands
# [...]
function parse_git_branch () {
local git_status="`git status -unormal 2>&1`"
# fatal: Not a git repository (or any of the parent directories): .git
if [[ $git_status == fatal* ]] ; then
echo ""
# On branch master
#
@pdarche
pdarche / gist:5034801
Created February 26, 2013 00:51
Open Paths in Ruby with the Crazylegs gem
require 'crazylegs'
consumer_key = "your consumer key"
consumer_secret = "your consumer secret"
base_url = "https://openpaths.cc/api/1"
credentials = Credentials.new(consumer_key,consumer_secret)
url = SignedURL.new(credentials, base_url,'GET')
signed_url = url.full_url
res = HTTParty.get(signed_url)
parsed = JSON.parse(res.parsed_response)
@vparihar01
vparihar01 / nokogiri_libxml_homebrew_lion_installation.sh
Created June 25, 2013 07:01
How to fix: Nokogiri Incompatible library version: nokogiri.bundle requires version 11.0.0 or later, but libxml2.2.dylib provides version 10.0.0. dlopen bundle.open. Using homebrew on lion to install nokogiri and lixml
FIXME:
WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
or
ERROR -: Incompatible library version: nokogiri.bundle requires version 11.0.0 or later, but libxml2.2.dylib provides version 10.0.0
gem uninstall nokogiri libxml-ruby
brew update
brew uninstall libxml2
@jbenet
jbenet / simple-git-branching-model.md
Last active July 21, 2025 21:02
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.