Skip to content

Instantly share code, notes, and snippets.

lucapette lucapette

  • Berlin, Germany
Block or report user

Report or block lucapette

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View setup_mac.sh
chflags nohidden ~/Library
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
defaults write com.apple.dock autohide -bool true
defaults write com.apple.dock autohide-delay -float 0
defaults write com.apple.dock launchanim -bool false
defaults write com.apple.dock magnification -bool false
defaults write com.apple.dock mru-spaces -bool false
defaults write com.apple.dock show-process-indicators -bool true
defaults write com.apple.dock size-immutable -bool true
@debasishg
debasishg / gist:8172796
Last active Oct 17, 2019
A collection of links for streaming algorithms and data structures
View gist:8172796
  1. General Background and Overview
@mislav
mislav / _readme.md
Last active Oct 17, 2019
tmux-vim integration to transparently switch between tmux panes and vim split windows
View _readme.md

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:

View application-notes-zero-downtime-deploys-unicorn-nginx-runit-rvm-chef.md

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
#!/usr/bin/tclsh8.5
#
# 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
}
View a.md

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
txus / Readme.md
Created Mar 11, 2012
RubyScript - A transcompiler transforming a subset of Ruby to JavaScript
View Readme.md

RubyScript

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

Installing and usage

curl https://raw.github.com/gist/2017173/efebd33d6ff430347ddb953c587318c8934cfd1e/rubyscript.rb > rubyscript
chmod +x rubyscript
./rubyscript my_file.rb > my_file.js
@dhedlund
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 (http://www.akalin.cx/longest-palindrome-linear-time). 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: http://www.therubygame.com/challenges/4

Algorithm

Original hand-work to discover a pattern:

@trevor
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)
yield(value)
value
end
You can’t perform that action at this time.