Skip to content

Instantly share code, notes, and snippets.

View mikehale's full-sized avatar

Michael Hale mikehale

  • Heroku
  • Holly Springs, NC
View GitHub Profile
@stevenharman
stevenharman / Gemfile
Created November 20, 2021 03:02
A minimally functional OpenTelemetry setup to send traces to Honeycomb. This leaves a lot to be desired, but is a starting point.
# Observability
gem "opentelemetry-sdk"
gem "opentelemetry-exporter-otlp"
gem "opentelemetry-instrumentation-all"
@hpjaj
hpjaj / gist:ef5ba70a938a963332d0
Created April 2, 2015 16:41
RSpec - List of available Expectation Matchers - from Lynda.com course 'RSpec Testing Framework with Ruby'
## From Lynda.com course 'RSpec Testing Framework with Ruby'
describe 'Expectation Matchers' do
describe 'equivalence matchers' do
it 'will match loose equality with #eq' do
a = "2 cats"
b = "2 cats"
expect(a).to eq(b)
@mikehale
mikehale / sync-gists.rb
Last active December 9, 2017 00:39
Sync all your gists to local disk
#!/usr/bin/env ruby
require 'excon'
require 'json'
module EnumerableEnumerator
def self.included(base)
base.extend ClassMethods
@ferd
ferd / ferd-lite.zsh-theme
Created April 1, 2014 01:12
ZSH theme for light background
PROMPT='$(prompt_clr)λ %{$fg[grey]%}%1~ $(prompt_mode) $(git_prompt_info)$(hg_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[yellow]%} → %{$reset_color%}"
function hg_prompt_info {
hg prompt --angle-brackets "\
<%{$fg[blue]%}<branch>%{$reset_color%}> \
<%{$fg[blue]%}<status|modified|unknown>%{$reset_color%} >" 2>/dev/null
}
#!/usr/bin/env ruby
require 'optparse'
require 'excon'
require 'json'
require 'uri'
require 'netrc'
class LibratoLogsUriFetcher
attr_reader :name, :user, :secret
@KartikTalwar
KartikTalwar / Documentation.md
Last active April 13, 2024 23:09
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
# Remove query string to eliminate openid attributes from query string (after we have the open_id_session_id cookie, and if this is not a call back from the IdP)
RewriteEngine On
RewriteCond %{HTTP_COOKIE} open_id_session_id
RewriteCond %{QUERY_STRING} openid
RewriteCond %{QUERY_STRING} !modauthopenid\.nonce
RewriteRule ^(.*)$ $1? [R]
<Location />
AuthName "Secure Location"
AuthType OpenID
@mikehale
mikehale / .zshrc
Created April 5, 2012 15:21
Ensure OSX Terminal has the current SSH_AUTH_SOCK
# Credit: http://www.dribin.org/dave/blog/archives/2007/11/28/ssh_agent_leopard/
function ssh_auth_socket_sync {
export SSH_AUTH_SOCK=$(ls -1t /tmp/launch-*/Listeners|head -n 1)
}
ssh_auth_socket_sync
@mikehale
mikehale / create_server.rb
Created September 28, 2011 17:15
Provision a Ubuntu 10.04 LTS (lucid) 256 server on Rackspace CloudServers with ssh password logins disabled
#!/usr/bin/env ruby
# This script provisions a Ubuntu 10.04 LTS (lucid) 256 server on
# Rackspace CloudServers with ssh password logins disabled and only
# the
# public key at ~/.ssh/id_rsa.pub authorized to login. The server will
# be terminated after 60 seconds. You need a CloudServers username and
# api_key to test this script.
require 'rubygems'
@ghoseb
ghoseb / factorial.py
Created November 14, 2008 18:58
The evolution of a Python Programmer
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal