Skip to content

Instantly share code, notes, and snippets.

@unphased
unphased / lust.zsh-theme.zsh.markdown
Last active December 13, 2015 16:48
My zsh-theme

GO HERE for theme file

Independent tweaks for zsh (put in .zshrc) follow:

# for oh my zsh plugins that are nice
plugins=(git cp osx zsh-syntax-highlighting) 

# no idea why oh my zsh does not take the existing path. hardcoding this is *bad*
export PATH=~/bin:~/util:$PATH:/usr/local/share/npm/bin

export PAGER=vimpager

@unphased
unphased / .tmux.conf
Last active December 14, 2015 19:58
This started out as a config that was mostly pulled from one of the first Google results for fmux.conf, and one of the first results for tmux. But now weighing in at 150 lines it is a force to be reckoned with.
# Report that we can handle 256 colors
# set -g default-terminal "xterm-256color"
# Rebind prefix to avoid conflicts
unbind C-b
set -g prefix C-a
# this is for convenience
bind C-d detach-client
@unphased
unphased / Default (Windows).sublime-keymap
Last active December 15, 2015 15:39
My Windows ST2 User keymap
[
// map ctrl+l to go to line
{ "keys": ["ctrl+l"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} },
// and ctrl+g does what F3 does
{ "keys": ["ctrl+g"], "command": "find_next" },
{ "keys": ["ctrl+shift+g"], "command": "find_prev" },
// overrides F-key functionality (only really used on Windows as OSX overloads f-keys with useful functionality)
{ "keys": ["f1"], "command": "new_file"},
{ "keys": ["f2"], "command": "next_view_in_stack"},
@unphased
unphased / Preferences.sublime-settings
Last active December 15, 2015 17:39
Sublime settings
{
"color_scheme": "Packages/Color Scheme - Default/Tomorrow Night Eighties.tmTheme",
"highlight_line": true,
"overlay_scroll_bars": "enabled",
"show_tab_close_buttons": false,
"theme": "Soda Dark.sublime-theme",
"default_line_ending": "unix",
"word_wrap": true,
"trim_trailing_white_space_on_save": true,
"scroll_past_end": true
@unphased
unphased / .gitconfig
Last active December 15, 2015 18:29
This is a good place to start when setting up git
[user]
name = Steven Lu
email = stevenlu443@gmail.com
[core]
editor = vim
whitespace = cr-at-eol
excludesfile = /Users/lust/.gitignore
[color]
ui = true
[alias]

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:

; This script has a special filename and path because it is automatically
; launched when you run the program directly. Also, any text file whose
; name ends in .ahk is associated with the program, which means that it
; can be launched simply by double-clicking it. You can have as many .ahk
; files as you want, located in any folder. You can also run more than
; one ahk file simultaneously and each will get its own tray icon.
Menu, MyMenu, Add, 4K @30, MenuHandler4K30
Menu, MyMenu, Add, 4K @60, MenuHandler4K
Menu, MyMenu, Add
function mapObj(obj, cb) {
var mappedObject = null;
var mappedArray = Object.keys(obj).map(function(e, i, a) {
var mapped = cb(e, obj[e], i);
if (mappedObject !== false && Array.isArray(mapped) && mapped.length === 2) {
if (!mappedObject) {
mappedObject = { };
}
mappedObject[mapped[0]] = mapped[1];
// always do the work of normal array mapping, I guess
@unphased
unphased / osxvpnrouting.markdown
Created March 25, 2020 08:19 — forked from taldanzig/osxvpnrouting.markdown
Routing tips for VPNs on OS X

Routing tips for VPNs on OS X

When VPNs Just Work™, they're a fantastic way of allowing access to a private network from remote locations. When they don't work it can be an experience in frustration. I've had situations where I can connect to a VPN from my Mac, but various networking situations cause routing conflicts. Here are a couple of cases and how I've been able to get around them.

Specific cases

Case 1: conflicting additional routes.

In this example the VPN we are connecting to has a subnet that does not conflict with our local IP, but has additional routes that conflict in some way with our local network's routing. In my example the remote subnet is 10.0.x.0/24, my local subnet is 10.0.y.0/24, and the conflicting route is 10.0.0.0/8. Without the later route, I can't access all hosts on the VPN without manually adding the route after connecting to the VPN: