Skip to content

Instantly share code, notes, and snippets.

@ezkl
ezkl / git-remote-output.md
Created September 27, 2011 19:47 — forked from bcg5017/new remote -v
The output of `git remote -v`

fetch is where you update from

git fetch origin master == fetch any updates from the remote repository called origin's master branch.

OR

git pull origin master == fetch any updates AND merge them into mine

origin	git@github.com:ezkl/code.ipsrvcs.com.git (fetch)

push is where you put your updates

@ezkl
ezkl / ezekiel_templin.rb
Created November 5, 2011 04:18
My Bio... in Ruby
class EzekielTemplin
def initialize
@birthdate = Date.parse('1983-06-29')
@birthplace = "Saegertown, PA"
@gender = "male"
end
def age
Date.today.year - @birthdate.year
end
# Much more realistic context.
def extract_prefix_from_path(path)
/(?<prefix>.+)_path/ =~ path.to_s ? prefix : false
end
path = extract_prefix_from_path("homepath")
puts path #=> false
puts extract_prefix_from_path("home_path") #=> home
@ezkl
ezkl / incoming_calls.rake
Created January 11, 2012 01:56 — forked from dannymcc/incoming_calls.rake
nokogiri and mechanize
desc "Import incoming calls"
task :fetch_incomingcalls => :environment do
# Logs into manage.phoneprovider.co.uk and retrieved list of incoming calls.
require 'rubygems'
require 'mechanize'
require 'logger'
# Create a new mechanize object
agent = Mechanize.new { |a| a.log = Logger.new(STDERR) }
@ezkl
ezkl / ty.rb
Created February 28, 2012 23:16
Typhoeus::Request shortcut
require "typhoeus"
module Ty
class << self
include Typhoeus
%w(get post put delete head).each do |method|
define_method(method.to_sym) do |url, opts = {}|
Request.send(method, url, opts)
end
guard 'spork', :wait => 60, :aggressive_kill => false, :notify_on_start => true do
watch('test/test_helper.rb') { :test_unit }
end
guard 'minitest', :drb => true do
watch(%r|^test/(.*)_spec\.rb|)
watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}#{m[2]}_spec.rb" }
watch(%r|^test/test_helper\.rb|) { "test" }
end
@ezkl
ezkl / mail.diff
Created March 15, 2012 17:34
mail v2.3.3 v2.4.0 diff
.gitignore | 2 +-
.travis.yml | 7 +
CHANGELOG.rdoc | 6 +
CONTRIBUTING.md | 45 ++
Gemfile | 10 +-
README.md | 649 ++++++++++++++++++
README.rdoc | 563 ----------------
Rakefile | 16 +-
lib/VERSION | 4 +-
lib/mail.rb | 4 +-
@ezkl
ezkl / iterm_tab.sh
Created April 1, 2012 17:54
Bash function to generate a new iTerm tab in the current directory
function tab() {
osascript -e "
tell application \"iTerm\"
tell the first terminal
launch session \"Default Session\"
tell the last session
write text \"cd $(pwd)\"
end tell
end tell
end tell"
@ezkl
ezkl / setup_heroku_for_193.sh
Created April 4, 2012 15:04
Setting up Heroku environment to run Ruby 1.9.3-p125
heroku labs:enable user_env_compile
heroku config:add RUBY_VERSION=ruby-1.9.3-p125
heroku config:add PATH=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin
@ezkl
ezkl / flashback_trojan_scan.sh
Created April 5, 2012 01:42
Poorly Written Flashback Trojan Scan
#!/usr/bin/env bash
browser_regex='Firefox|Chrome|Safari'
infected=0
shift
echo "============================="
echo "Scanning for Flashback Trojan"
echo "============================="
echo
shopt -s nullglob