Skip to content

Instantly share code, notes, and snippets.

@heartpunk
heartpunk / bb-m.rubygems.org
Last active December 22, 2015 19:19
a bundler/open ssl bug

➜ FILTERED git:(master) openssl s_client -connect bb-m.rubygems.org:443 CONNECTED(00000003) depth=1 /C=US/O=GeoTrust, Inc./CN=RapidSSL CA verify error:num=20:unable to get local issuer certificate verify return:0 — Certificate chain 0 s:/serialNumber=RRAXldgzDrRZWQpGo6FHdTHV3qwvwXtD/OU=GT35895174/OU=See www.rapidssl.com/resources/cps (c)13/OU=Domain Control Validated - RapidSSL(R)/CN=*.rubygems.org i:/C=US/O=GeoTrust, Inc./CN=RapidSSL CA 1 s:/C=US/O=GeoTrust, Inc./CN=RapidSSL CA

vagrant@precise32:/vagrant$ time sh -c 'git stash&&git stash pop'
Saved working directory and index state WIP on master: 3ddcb3a Merge pull request #81 from DDS32/password_reset_templates
HEAD is now at 3ddcb3a Merge pull request #81 from DDS32/password_reset_templates
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: Gemfile
# modified: Gemfile.lock
@heartpunk
heartpunk / squid_woes.txt
Created September 1, 2013 08:54
a problem I'm having with squid.
root@precise64:~# docker run 4d81efd4322a `which bash` -c "http_proxy=\"http://172.17.42.1:3128/\" curl -v wikipedia.org>/dev/null"
WARNING: IPv4 forwarding is disabled.
* About to connect() to proxy 172.17.42.1 port 3128 (#0)
* Trying 172.17.42.1...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* connected
* Connected to 172.17.42.1 (172.17.42.1) port 3128 (#0)
> GET HTTP://wikipedia.org HTTP/1.1
> User-Agent: curl/7.27.0
/Users/tehgeekmeister/.rvm/gems/ruby-1.9.3-p448/gems/pry-stack_explorer-0.4.9.1/lib/pry-stack_explorer/when_started_hook.rb:6: [BUG] Segmentation fault
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin12.4.0]
-- Control frame information -----------------------------------------------
c:0042 p:---- s:0166 b:0166 l:000165 d:000165 CFUNC :callers
c:0041 p:0019 s:0163 b:0163 l:0003c8 d:0003c8 METHOD /Users/tehgeekmeister/.rvm/gems/ruby-1.9.3-p448/gems/pry-stack_explorer-0.4.9.1/lib/pry-stack_explorer/when_started_hook.rb:6
c:0040 p:0136 s:0158 b:0158 l:002228 d:002228 METHOD /Users/tehgeekmeister/.rvm/gems/ruby-1.9.3-p448/gems/pry-stack_explorer-0.4.9.1/lib/pry-stack_explorer/when_started_hook.rb:38
c:0039 p:0019 s:0151 b:0151 l:002380 d:002460 BLOCK /Users/tehgeekmeister/.rvm/gems/ruby-1.9.3-p448/gems/pry-0.9.12.2/lib/pry/hooks.rb:154
c:0038 p:---- s:0146 b:0146 l:000145 d:000145 FINISH
c:0037 p:---- s:0144 b:0144 l:000143 d:000143 CFUNC :map
@heartpunk
heartpunk / pry_setter.rb
Last active December 21, 2015 12:08
a thing to see where a singleton attribute is being set when you're confused.
def pry_setter_on_class(klass, attr)
klass.define_singleton_method("#{attr}=") do |sym|
binding.pry
klass.instance_variable_set "@#{attr}", sym
end
end
# NOTE: this is untested.
def pry_setter_on_instance(klass, attr)
klass.define_method("#{attr}=") do |sym|
@heartpunk
heartpunk / rust traits.rs
Created July 9, 2013 04:26
problem with traits in rust
trait Stack<T> {
fn push(~self, item : T) -> Self;
fn pop(~self) -> Option<T>;
fn new() -> Self;
}
enum Chain<T> {
Link(T, ~Chain<T>),
Break
}
@heartpunk
heartpunk / magnitude_set.clj
Created June 4, 2013 02:11
A cool idea for how to use sorted sets with arbitrary comparators, stolen from Programming Clojure.
(defn compare-magnitude [a b]
(- (magnitude a) (magnitude b)))
((comparator compare-magnitude) 10 10000) ;= -1
((comparator compare-magnitude) 100 10) ;= 1
((comparator compare-magnitude) 10 75) ;= 0
(sorted-set-by compare-magnitude 10 1000 500) ;= #{10 500 1000}
(conj *1 600) ;= #{10 500 1000}
(disj *1 750) ;= #{10 1000}
@heartpunk
heartpunk / wtf rails
Created June 2, 2013 21:00
different output from same version rails gem on heroku and my box.
➜ write_some git:(rails_4_rc1) heroku run -a the_app rails --version
Running `rails --version` attached to terminal... up, run.6841
Rails 4.0.0.rc1
➜ write_some git:(rails_4_rc1) heroku run -a the_app rails
Running `rails` attached to terminal... up, run.2087
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
@heartpunk
heartpunk / gist:5648058
Created May 25, 2013 05:50
It appears I left myself a little surprise in an app I'm just getting back to doing some work on...
➜ write_some git:(master) ✗ bundle exec ./script/rails s
=> Booting Thin
=> Rails 4.0.0.rc1 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
WHAT THE FUCKING FUCK
@heartpunk
heartpunk / leak_finder.rb
Created April 19, 2013 21:17
a memory leak debugging tool that you probably should not use.
class Class
$allocs = []
$depth = 0
def _new *args
$depth += 1
$allocs << [self.class, Kernel.caller] if $depth <= 1
$depth -= 1
old_new *args
end