Skip to content

Instantly share code, notes, and snippets.

@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

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:

@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

@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.
@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
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
@bdha
bdha / vbox_to_kvm.txt
Created March 1, 2012 04:04
Migrating from VirtualBox to KVM on ZFS
# It's important to convert the vbox image (VMDK or VDI or whatever) using
# the same version of VirtualBox that created it. You can try converting the image
# with qemu-img or kvm-img, but weird version mismatches will possibly make it not
# work.
# On your VirtualBox machine:
cd $VBOX_ROOT/$MACHINE_ROOT/
VBoxManage clonehd machine.vmdk machine.img --format RAW
scp machine.img root@kvm-host:/somewhere
@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
@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
#!/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