Skip to content

Instantly share code, notes, and snippets.

View zsimic's full-sized avatar

Zoran Simic zsimic

  • Netflix
  • Los Gatos, CA
  • 10:36 (UTC -07:00)
View GitHub Profile
// 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,
@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;
}
@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)
)
)
"""
Support for understanding files/folders to ignore (from .gitignore or .svnignore)
These classes should be reusable, can be moved to a library
Example usage:
ignored_file = IgnoredFiles(mypath)
for root, dirs, files in os.walk(mypath):
ignored_files.remove_ignored_folders(root, dirs)
; -- Remap Alt -> Ctrl on Windows (to behave like ⌘CMD+key on mac)
; Via https://www.autohotkey.com/docs/misc/Remap.htm
; Alt+key on Windows is just a general shortcut to application menu...
; I find that undesirable/annoying, and prefer to simply have all Alt+key combinations be CTRL+key instead
; Benefits:
; - CMD is much more natural to hit (less finger stretching to reach CTRL)
; - no UI menu distractions while using keyboard
; - makes it easy to configure many dev tools in the same way on mac/Windows
; -- Remap Alt -> Ctrl on Windows (to behave like ⌘CMD+key on mac)
; Via https://www.autohotkey.com/docs/misc/Remap.htm
; This remaps Alt -> Ctrl completely, except for Alt+Tab and Alt+F4
#SingleInstance ignore
SetCapsLockState, AlwaysOff ; disable caps lock entirely
CapsLock::return
RAlt::RCtrl ; Right Alt key is simply mapped to Ctrl, RAlt+Tab won't work as usual (only LAlt+Tab will)
@zsimic
zsimic / starship.toml
Created December 17, 2020 02:03
startship.toml
# My config for https://starship.rs/
# It's minimalistic, I like single-line prompts, features:
# - show active python version when non-system python is on PATH
# - show duration only when last command took more than 5s
format="$cmd_duration$custom$directory$character"
add_newline = false
[directory]
format = "[$path]($style)[$read_only]($read_only_style)"
@zsimic
zsimic / Non-staggered,-compact.kbd.json
Last active March 24, 2021 21:56
Non staggered, compact
[
{
"name": "Non staggered, compact",
"author": "Zoran Simic"
},
[
"Esc",
{
"x": 0.5
},
{
"Key Mappings": {
"0x2a-0x200000": {
"Action": 12,
"Text": "*"
},
"0x2b-0x200000": {
"Action": 12,
"Text": "+"
},
@zsimic
zsimic / Compact,-staggered.kbd.json
Last active April 10, 2023 03:57
Compact, staggered
[
{
"name": "Compact, staggered",
"author": "Zoran Simic"
},
[
{
"c": "#768e72"
},
"Esc",