Skip to content

Instantly share code, notes, and snippets.

View marianposaceanu's full-sized avatar

Posăceanu Marian marianposaceanu

View GitHub Profile
@marianposaceanu
marianposaceanu / branching.md
Last active April 14, 2016 09:54
Git: naming branches

Examples

I'm working on a feature in ticket 59:

git co -b feature/59/add-filtering

I'm working on a bug:

git co -b bug/101/template-error

# The classics
class Foo
def bar; end
def self.baz; end
end
Foo.instance_method(:bar).source_location
Foo.method(:baz).source_location
# A tad more
@marianposaceanu
marianposaceanu / ElCapitan.applescript
Created February 17, 2016 00:35 — forked from nrollr/ElCapitan.applescript
Performance improvements for El Capitan
-- Disable Time Machine Local Backups
sudo tmutil disablelocal
-- Disable Automatic Spell Checker
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false
-- Disable animations when opening and closing windows.
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false
-- Disable animations when opening a Quick Look window.
defaults write -g QLPanelAnimationDuration -float 0
-- Accelerated playback when adjusting the window size (Cocoa applications).
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
run_with_tco = ARGV.include?('-TCO')
# Force the ruby interpreter to use TCO
RubyVM::InstructionSequence.compile_option = {
tailcall_optimization: true,
trace_instruction: false
} if run_with_tco
puts 'To infinity and beyond!' if run_with_tco
# Definition of banning something
# to_ban = 'To prohibit (an action) or forbid the use of (something)'
EVERYTHING = -> (existing_bans) { def existing_bans.include?(obj); true; end }
@bans = []
ban_something = -> (how_to_ban) { how_to_ban.call(@bans) }
# Some simple tests
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