Skip to content

Instantly share code, notes, and snippets.

lucapette lucapette

  • Berlin, Germany
View GitHub Profile
chflags nohidden ~/Library
defaults write DSDontWriteNetworkStores -bool true
defaults write DSDontWriteUSBStores -bool true
defaults write autohide -bool true
defaults write autohide-delay -float 0
defaults write launchanim -bool false
defaults write magnification -bool false
defaults write mru-spaces -bool false
defaults write show-process-indicators -bool true
defaults write size-immutable -bool true
debasishg / gist:8172796
Last active Jun 24, 2020
A collection of links for streaming algorithms and data structures
View gist:8172796
  1. General Background and Overview
mislav /
Last active Jun 11, 2020
tmux-vim integration to transparently switch between tmux panes and vim split windows

I use tmux splits (panes). Inside one of these panes there's a Vim process, and it has its own splits (windows).

In Vim I have key bindings C-h/j/k/l set to switch windows in the given direction. (Vim default mappings for windows switching are the same, but prefixed with C-W.) I'd like to use the same keystrokes for switching tmux panes.

An extra goal that I've solved with a dirty hack is to toggle between last active panes with C-\.

Here's how it should work:


Zero downtime deploys with unicorn + nginx + runit + rvm + chef

Below are the actual files we use in one of our latest production applications at Agora Games to achieve zero downtime deploys with unicorn. You've probably already read the GitHub blog post on Unicorn and would like to try zero downtime deploys for your application. I hope these files and notes help. I am happy to update these files or these notes if there are comments/questions. YMMV (of course).

Other application notes:

  • Our application uses MongoDB, so we don't have database migrations to worry about as with MySQL or postgresql. That does not mean that we won't have to worry about issues with the database with indexes being built in MongoDB or what have you.
  • We use capistrano for deployment.

Salient points for each file:

View gist:4554824
# Usage: git-unmerged branch1 branch2
# Shows all the non-common commits in the two branches, where non-common
# commits means simply commits with a unique commit *message*.
proc getlog branch {
lrange [split [exec git log $branch --oneline] "\n"] 0 400

This allows you to use the following video streaming services outside of the US from your Mac without having to use a proxy or VPN, so no big bandwidth issues:

  • Hulu / HuluPlus
  • CBS
  • ABC
  • MTV
  • theWB
  • CW TV
  • Crackle
  • NBC
txus /
Created Mar 11, 2012
RubyScript - A transcompiler transforming a subset of Ruby to JavaScript


A ~400LOC transcompiler transforming a subset of Ruby to JavaScript.

Installing and usage

curl > rubyscript
chmod +x rubyscript
./rubyscript my_file.rb > my_file.js
dhedlund / gist:1561873
Created Jan 4, 2012
Palindrome Iteration
View gist:1561873

Discovered an interesting algorithm for finding longest palindrome by playing with sequences in a text editor. Anyone know if there's a name for this algorithm?

Worst running time is O(n^2), which is better than the naive implementation of O(n^3) but not as efficient as some O(n) implementations ( In general, assuming a non-pathological case, running time is around 2n * m where n is the length of the string and m is the mean length of all palindromes. For non-pathological cases (i.e. human sentences), n is often logarithmic (log n) and fast approaches 1 as n increases. This puts the average case complexity at around n log n and best-case n.

Developed as a solution to:


Original hand-work to discover a pattern:

trevor / example.rb
Created Jul 15, 2011
deep sorting hashes in ruby
View example.rb
require 'active_support'
# in some cases i've found JSON.pretty_generate doesn't output properly
# when combined with ActiveSupport::OrderedHash without json/pure
# require 'json/pure'
def returning(value)
You can’t perform that action at this time.