Skip to content

Instantly share code, notes, and snippets.

View timoschilling's full-sized avatar
👻
yolo

Timo Schilling timoschilling

👻
yolo
View GitHub Profile
@deepak
deepak / ruby_thread_parent.rb
Created November 1, 2010 11:30
keep track of the parent of a ruby thread.rb
T0 = Thread.main
t1 = Thread.new(Thread.current) { |x| Thread.current[:parent] = x; sleep 1_00_000; }
t2 = Thread.new(Thread.current) { |x| Thread.current[:parent] = x; sleep 1_00_000; }
(t1[:parent] == t2[:parent]) && (t1[:parent] == T0)
__END__
# to find out the parent of a thread, ie. was spawned by which thread
@dx7
dx7 / gist:1333785
Created November 2, 2011 14:33
Installing ruby-debug with ruby-1.9.3-p0
### UPDATE: ruby-debuy19 is no longer maintained, use https://github.com/cldwalker/debugger
# Install with:
# bash < <(curl -L https://raw.github.com/gist/1333785)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Installing ruby-debug with ruby-1.9.3-p0 ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
@jiphex
jiphex / purge.rb
Created November 14, 2011 10:13
Ruby Varnish Purge Script
#!/usr/bin/env ruby
# Ruby varnish purger
require 'net/http'
module Net
class HTTP::Purge < HTTPRequest
METHOD='PURGE'
REQUEST_HAS_BODY = false
RESPONSE_HAS_BODY = true
@rajraj
rajraj / es.sh
Created January 3, 2012 20:07 — forked from aaronshaf/es.sh
Install ElasticSearch on CentOS 6
cd ~
sudo yum update
sudo yum install java-1.7.0-openjdk.i686 -y
wget https://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.9.tar.gz -O elasticsearch.tar.gz
tar -xf elasticsearch.tar.gz
rm elasticsearch.tar.gz
mv elasticsearch-* elasticsearch
sudo mv elasticsearch /usr/local/share
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@fujin
fujin / foo.rb
Created January 31, 2012 21:49
template override between cookbooks
template "/tmp/foo.rb"
source "foo.rb.erb"
cookbook "banana"
end
@stevenh512
stevenh512 / gitconfig-git
Created June 11, 2012 10:51
URL rewriting in .gitconfig
# Use git and git+ssh instead of https
[url "git://github.com/"]
insteadOf = https://github.com/
[url "git@github.com:"]
pushInsteadOf = "git://github.com/"
[url "git@github.com:"]
pushInsteadOf = "https://github.com/"
@steveklabnik
steveklabnik / proposal.md
Created June 25, 2012 17:44
Development and Philosophy

We spend most of our times obsessing about the actual act of programming. Is this method name too long? Should I refactor this code? How do I fix this bug? However, sometimes, large gains can be made by drawing in experience from totally different fields.

I think there's a lot a programmer can learn from the study of epistemology, logic, metaphysics, moral and political philosophy, and aesthetics. In this talk, I'll give an overview of a bunch of interesting thinkers, philosophical problems, and how they relate to the worlds of software development, open source, and startups.

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@itod
itod / remove_prefix.applescript
Last active November 21, 2016 03:56
AppleScript to remove a common prefix from the name of all files in a given folder.
set path_ to (get path to desktop as string) & "FOLDER NAME HERE"
set prefix_ to "PREFIX HERE"
tell application "Finder"
set dir_ to folder path_
set files_ to items of dir_ whose name of it starts with prefix_
set start_ to (get length of prefix_) + 1
repeat with file_ in files_
set oldname_ to name of file_
set end_ to length of oldname_