Skip to content

Instantly share code, notes, and snippets.

@JakubOboza
JakubOboza / gist:1106325
Created July 26, 2011 09:00
Ruby Style Guide
Original Source: https://github.com/chneukirchen/styleguide
= Christian Neukirchen's Ruby Style Guide
You may not like all rules presented here, but they work very well for
me and have helped producing high quality code. Everyone is free to
code however they want, write and follow their own style guides, but
when you contribute to my code, please follow these rules:
@beastaugh
beastaugh / installing-ghc7.2-osx10.7.md
Created August 24, 2011 21:41
Installing GHC 7.2 on Mac OS X 10.7 Lion

Installing GHC 7.2 on Mac OS X

This is a brief and bare-bones guide to getting GHC 7.2 and the cabal-install tool (the two basic things you'll need to do Haskell development) up and running on a new Mac OS X 10.7 install.

The instructions given here worked for me, but YMMV.

#!/bin/bash
## MOVED TO https://github.com/sickill/git-dude
INTERVAL=30
ICON_PATH=`pwd`/icon.png
export LC_ALL=C # make sure git talks english
while [ 1 ]; do
for dir_name in *; do
@solnic
solnic / improved_dirty_tracking_in_dm_1.2.0.rb
Created October 13, 2011 11:25
improved_dirty_tracking_in_dm_1.2.0.rb
require 'rubygems'
require 'data_mapper'
DataMapper.setup :default, 'sqlite::memory:'
class Book
include DataMapper::Resource
property :id, Serial
property :meta, Json
@JakubOboza
JakubOboza / mongoid_tags.rb
Created November 22, 2011 15:04
tags formongoid collections.
module Mongoid
module Document
module Taggable
def self.included(base)
base.class_eval do |base_document|
base_document.field :tags, :type => Array, :default => []
base_document.index :tags
include InstanceMethods
extend ClassMethods
@benmmurphy
benmmurphy / README.md
Last active December 17, 2015 11:09
TIMED_WAIT verifier

replays last FIN-ACK in order to check if the other side correctly implements TIMED-WAIT. other side should be first to close the connection. with http this can be done in curl by forcing http/1.0 mode.

curl -0 -d 'lolol=lololol' http://TARGET/wtwtwt
tcpdump -S 'tcp port 80' -l | ./replayer.rb TARGET 80 YOUR_HOST_AS_APPEARS_IN_TCPDUMP

Example of it working and showing the other side correctly handling TIMED-WAIT:

root@midway:~# tcpdump -S 'tcp port 80' -l | ./replayer.rb 173.194.41.67 80 ip-10-250-157-181.eu-west-1.compute.internal
OMG IM RUNNING

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode

@ku1ik
ku1ik / nginx.conf
Created April 25, 2012 19:24 — forked from lucasmazza/conf.md
Nginx upstart script that WORKS with Passenger.
description "nginx http daemon"
start on runlevel [2]
stop on runlevel [016]
console owner
exec /opt/nginx/sbin/nginx -c /opt/nginx/conf/nginx.conf -g "daemon off;"
respawn
@jpayne
jpayne / Acknowledgement.txt
Created September 8, 2012 17:33
Start multiple Resque workers with Upstart
Thanks to Jason Roelofs for his article at http://jasonroelofs.com/2012/03/12/manage-and-monitor-resque-with-upstart-and-monit/ which got me most of the way there.

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@davidkellis
davidkellis / gist:909449e13905d8bfbd49c30d20f7fbca
Last active September 7, 2017 13:35 — forked from silviorelli/gist:ad8e1d80bdc0245eb7e7
Install Ruby 1.8.7 on macOS Sierra (10.12) with rbenv
brew install apple-gcc42 openssl libyaml libffi
xcode-select --install
export CC=/usr/local/bin/gcc-4.2
export CFLAGS='-g -O2'
export RUBY_CONFIGURE_OPTS=--with-openssl-dir=`brew --prefix openssl`
export CONFIGURE_OPTS=--with-openssl-dir=`brew --prefix openssl`
# I had to edit the svn repo URL in /usr/local/Cellar/ruby-build/20160913/share/ruby-build/1.8.7-p375 and change the URL from http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7 to https://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8_7
rbenv install 1.8.7-p375