Skip to content

Instantly share code, notes, and snippets.

@JakubOboza
JakubOboza / gist:68b64230e9270403526828d82ff2461e
Created June 30, 2017 15:55 — forked from davidkellis/gist:909449e13905d8bfbd49c30d20f7fbca
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:

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

@JakubOboza
JakubOboza / request post node.js
Created February 10, 2012 00:01 — forked from alessioalex/request post node.js
request post node.js
var request = require('request'), default_headers, site_root = 'http://localhost:3000';;
default_headers = {
'User-Agent': 'Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20100101 Firefox/7.0.1',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'en-us,en;q=0.5',
'Accept-Encoding': 'gzip, deflate',
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
// 'Connection': 'keep-alive',
'Cache-Control': 'max-age=0'
@JakubOboza
JakubOboza / 0_README.md
Created January 18, 2012 11:13 — forked from netzpirat/0_README.md
Continuous CoffeeScript testing with Guard and Jasmine

Continuous CoffeeScript testing with Guard and Jasmine

This Gist shows how to set up a Rails project to practice BDD with CoffeeScript, Guard and Jasmine. You can see this setup in action on Vimeo

  • Install Gems with Bundler with bundle install
  • Define your guards with mate Guardfile
  • Initialize Jasmine with bundle exec jasmine init
  • Configure Jasmine with mate spec/support/yasmine.ym
  • Start Guard with bundle exec guard
@JakubOboza
JakubOboza / installing-ghc7.2-osx10.7.md
Created December 10, 2011 12:14 — forked from beastaugh/installing-ghc7.2-osx10.7.md
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.

@JakubOboza
JakubOboza / Gemfile
Created November 26, 2011 22:35
facebook authentication with Rails 3.1 and OmniAuth 1.0 and Devise 1.5
gem 'devise', '1.5.0'
gem 'omniauth-facebook', :git => "git://github.com/mkdynamic/omniauth-facebook.git"
gem 'rspec-rails', :group => [:development, :test]
group :test do
# Pretty printed test output
gem 'turn', '< 0.8.3', :require => false
gem 'cucumber-rails'
gem 'capybara'
@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:
@JakubOboza
JakubOboza / mrisc.rb
Created July 8, 2011 10:22 — forked from pachacamac/mrisc.rb
A Simple Assembler Language and VM
#!/usr/bin/env ruby
class MRISC
def run(code)
tokens = code.gsub(/(\*.*?\*)|[^a-z0-9,-;@\._]/,'').split(';')
@vars,stack,i = {:_pc=>-1,:_oc=>0},[],0
tokens.map!{|t| t.chars.first=='@' ? (@vars[t.to_sym]=i-1;nil) : (i+=1;t.split(',').map{|e|numeric?(e) ? e.to_i : e.to_sym})}.compact!
while @vars[:_pc] < tokens.size-1
@vars[:_pc] += 1
@vars[:_oc] += 1
@JakubOboza
JakubOboza / Toggle Function Keys.scpt
Created July 5, 2011 14:49 — forked from ysamlan/Toggle Function Keys.scpt
Toggle function keys / media keys on OS X 10.6 & show current status with Growl (updated from http://macsteps.com/blog/tips/how-to-quickly-toggle-your-keyboards-function-keys/ which only works on 10.5)
tell application "System Preferences"
set current pane to pane "com.apple.preference.keyboard"
end tell
tell application "System Events"
-- If we don't have UI Elements enabled, then nothing is really going to work.
if UI elements enabled then
tell application process "System Preferences"
get properties