Skip to content

Instantly share code, notes, and snippets.

View zsimic's full-sized avatar

Zoran Simic zsimic

  • Netflix
  • Los Gatos, CA
  • 00:08 (UTC -07:00)
View GitHub Profile
@zsimic
zsimic / DefaultKeyBinding.dict
Last active April 22, 2024 14:40
OSX key bindings
{
/* ~/Library/KeyBindings/DefaultKeyBinding.dict
See https://gist.github.com/zsimic/1367779, prefix cheatsheet:
Char Short Key
$ S- Shift ⇧
^ C- CTRL ⌃
~ O- Option ⌥ (⊞ Win key position on PC)
@ M- Command ⌘ (Alt position on PC)
# Numeric Keypad
@zsimic
zsimic / obfuscated-python
Created November 13, 2011 19:25
obfuscated python hack writing 'python'
def m(x): return -1 if x%3 else 1
def g(x): return cmp(2.5-x, 0)
print ''.join(chr(ord('a') + x)
for x in reduce(
lambda x,y: x+[x[-1]+y*m(len(x)-1)] if isinstance(x,list) else [x,x+y],
reduce(
lambda x,y: x+[x[-1]+g(y-2)*(y-2+cmp(g(y-2)+m(y-1),0)*cmp(6-y,0))+(8-y)*m(y-1)] if x else [15],
range(7)
)
)
@zsimic
zsimic / bitcount.java
Created October 12, 2011 01:33
Bit counting
public static int countBits1(long x) {
int c = 0;
long v = x;
while (v!=0) {
v &= v - 1;
c++;
}
return c;
}
// Settings in here override those in "Default/Base File.sublime-settings", and
// are overridden in turn by file type specific settings. Place your settings
// here, to ensure they're preserved when upgrading.
{
"tab_completion": false,
"rulers": [140], // Columns in which to display vertical rulers
"word_wrap": false,
"highlight_line": false,
"caret_style": "wide", // Valid values are "smooth", "phase", "blink", "wide" and "solid".
"line_padding_top": 1,