Skip to content

Instantly share code, notes, and snippets.

View marianposaceanu's full-sized avatar

Posăceanu Marian marianposaceanu

View GitHub Profile
require 'benchmark'
include Benchmark
n = 500000
Benchmark.benchmark(CAPTION, 20, FORMAT, ">total:", ">avg:") do |x|
x.report('via usual syntactics') { n.times { class MyError < StandardError ; end && Object.send(:remove_const, 'MyError') } }
x.report('via Class.new') { n.times { MyError = Class.new(StandardError) && Object.send(:remove_const, 'MyError') } }
end
# Results

Force external LCD into RGB mode in OS X El Capitan

disclaimer:

  • only do this if the external display is blurry and looks scaled down. (I have this issue on a brand new Eizo EV2455)
  • you might want to read the linked articles in the credits for updated information

Steps:

  1. ruby patch-edid.rb => will generate a directory similar to DisplayVendorID-15c3
#!/bin/bash -ex
### More info: https://coderwall.com/p/a56j3w/memory-efficient-ubuntu-vms
### configuration
PKGS_TO_ADD="$PKGS_TO_ADD curl git etckeeper python-software-properties"
PKGS_TO_REMOVE="$PKGS_TO_REMOVE geoip-database popularity-contest"
PKGS_TO_REMOVE="$PKGS_TO_REMOVE pppoeconf pppconfig ppp"
PKGS_TO_REMOVE="$PKGS_TO_REMOVE ubuntu-standard memtest86+" # warning: be careful about what you remove after this
@marianposaceanu
marianposaceanu / mavericks_osx_unixbench.md
Created August 18, 2014 16:30
How to install UnixBench on Mavericks

How to install UnixBench on Mavericks:

$ wget https://byte-unixbench.googlecode.com/files/UnixBench5.1.3.tgz
$ tar xzvf UnixBench5.1.3.tgz
$ git clone https://gist.github.com/11033924.git
$ cd UnixBench
$ patch -p1 < ../11033924/UnixBench5.1.3.mavericks.patch
$ make
$ ./Run
@marianposaceanu
marianposaceanu / puma_vs_unicorn.md
Last active November 13, 2016 04:06
puma 2.9.0 vs unicorn 4.8.3

Environment info

  • Ruby 2.1.2
  • 2.8Ghz Core i7 / 2 cores - 4 hardware threads / 8G Ram

Unicorn 4.8.3

Using four workers

task :ask_production_confirmation do
set(:confirmed) do
puts <<-WARN
========================================================================
WARNING: You're about to perform actions on production server(s)
Please confirm that all your intentions are kind and friendly
========================================================================
  • The Catcher in the Rye, J.D. Salinger: It shows you what a teenager thinks. His fears, what does he loves and how can they react.

  • On the Road, Jack Kerouac: The author can make you feel that you are traveling on the routes of United States in late 40s. He can make you feel free.

  • High Fidelity, Nick Hornby: I love music and this is a perfect book for music lovers. In the end, is a book about love, but in the middle of it is full of songs.

  • Ham on Rye, Charles Bukowski: Hank is one of my favorites writers (his poetry is amazing) and this is an autobiography. Every anecdote makes us understand why Bukowski thinks as he does.

  • A Moveable Feast, Ernest Hemingway: This book narrates Hemingway’s life in París in the 20s as an expatriate writer. You can read it 30 times.