Skip to content

Instantly share code, notes, and snippets.

View tmm1's full-sized avatar

Aman Gupta Karmani tmm1

View GitHub Profile
@lwe
lwe / brew-services.rb
Created January 5, 2011 13:13
External script for homebrew to simplify starting services via launchctl, out of the box support for any formula which implements #startup_plist.
#!/usr/bin/env ruby -w
# brew-services(1) - Easily start and stop formulas via launchctl
# ===============================================================
#
# ## SYNOPSIS
#
# [<sudo>] `brew services` `list`<br>
# [<sudo>] `brew services` `restart` <formula><br>
# [<sudo>] `brew services` `start` <formula> [<plist>]<br>
@protocool
protocool / caveatPatchor.js
Created February 11, 2011 01:00
Sample Propane caveatPatchor.js file
/**
Sample Propane caveatPatchor.js file based on tmm1's avatar hack.
You'll need at least version 1.1.1 to experiment with this:
http://propaneapp.com/appcast/Propane.1.1.1.zip
Once I'm sure exposing this hack-injection point doesn't cause problems
I'll do an official auto-updating version.
As of version 1.1.1, Propane will load and execute the contents of
@lusis
lusis / rb-trace-300-lines.log
Created March 19, 2011 04:54
First 300 lines of the 22GB rbtrace log
EventMachine::Hiredis::Connection#receive_data
Hiredis::Reader#feed <0.000003>
Hiredis::Reader#gets
Encoding.default_external <0.000002>
String#force_encoding <0.000002>
Encoding.default_external <0.000001>
String#force_encoding <0.000001>
Encoding.default_external <0.000000>
String#force_encoding <0.000001>
Encoding.default_external <0.000001>
module Test
module Unit
TestCase = RSpec::Core::ExampleGroup
end
end
class Test::Unit::TestCase
def self.inherited(host)
host.set_it_up host.name.gsub(/(Spec|Test)/,'')
def host.method_added(name)
@mbleigh
mbleigh / Gemfile
Created March 21, 2012 03:14
Non-Rails Rackup with Sprockets, Compass, Handlebars, Coffeescript, and Twitter Bootstrap
source "https://rubygems.org"
gem 'sprockets'
gem 'sprockets-sass'
gem 'sass'
gem 'compass'
gem 'bootstrap-sass'
gem 'handlebars_assets'
gem 'coffee-script'
@authorNari
authorNari / gc-cow.rb
Created March 24, 2012 00:38 — forked from wr0ngway/gc-cow.rb
test to see if GC in ruby 2 is truly copy on write friendly
#!/usr/bin/env ruby
rss = '.+?Rss:\s+(\d+)'
share = '.+?Shared_Clean:\s+(\d+)'
share << '.+?Shared_Dirty:\s+(\d+)'
priv = '.+?Private_Clean:\s+(\d+)'
priv << '.+?Private_Dirty:\s+(\d+)'
MEM_REGEXP = /\[heap\]#{rss}#{share}#{priv}/m
def mem_usage()
@cypriss
cypriss / action_mailer_no_tmail.rb
Created August 14, 2012 17:32
Use TMail -> Mail gem in Rails 2.3
require 'action_mailer'
require 'mail'
module ActionMailer
class Base
def clean_address(str)
EmailAddress.parse(str, :no_default_name => true).quoted rescue str
end
@wsargent
wsargent / docker_cheat.md
Last active August 31, 2023 12:10
Docker cheat sheet
@alloy
alloy / gist:7527832
Created November 18, 2013 13:39
VIM config to deal with (MRI) Ruby’s C source code indentation.
" These VIM rules match the MRI C indentation rules.
"
" To enable use of this project specific config, add the following to your
" ~/.vimrc:
"
" " Enable per-directory .vimrc files
" set exrc
" " Disable unsafe commands in local .vimrc files
" set secure
anonymous
anonymous / frozen_string.diff
Created November 26, 2013 04:08
diff --git a/compile.c b/compile.c
index 9ff3bf5..306fd80 100644
--- a/compile.c
+++ b/compile.c
@@ -172,10 +172,10 @@ r_value(VALUE value)
(((rb_iseq_t*)DATA_PTR(iseq))->filepath)
#define NEW_ISEQVAL(node, name, type, line_no) \
- new_child_iseq(iseq, (node), (name), 0, (type), (line_no))
+ new_child_iseq(iseq, (node), rb_str_frozen_literal(name), 0, (type), (line_no))