Skip to content

Instantly share code, notes, and snippets.

View yoshuawuyts's full-sized avatar

Yosh yoshuawuyts

View GitHub Profile
@yoshuawuyts
yoshuawuyts / lens.js
Last active August 29, 2015 14:12 — forked from andyhd/lens.js
function lens(get, set) {
var f = function (a) { return get(a); };
f.set = set;
f.mod = function (f, a) { return set(a, f(get(a))); };
return f;
}
var first = lens(
function (a) { return a[0]; },
function (a, b) { return [b].concat(a.slice(1)); }

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@yoshuawuyts
yoshuawuyts / .tmux.conf
Last active August 29, 2015 14:13 — forked from iboard/.tmux.conf
set-window-option -g utf8 on
set -g mode-mouse on
set -g mouse-resize-pane on
set -g mouse-select-pane on
set -g mouse-select-window on
set-option -g prefix C-q
set -g history-limit 50000
unbind-key C-b
bind-key q send-prefix
set -g base-index 1
# add this to your .zshrc and then add
# $(__prompt_color) to your PROMPT
function __prompt_color()
{
local RGB CONVERTED RH GH BH RD GD BD
RGB=$(echo $(pwd) | md5 | cut -c 1-6)
RH=$(echo ${RGB} | cut -c 1-2)
GH=$(echo ${RGB} | cut -c 3-4)
@yoshuawuyts
yoshuawuyts / _readme.md
Last active August 29, 2015 14:13 — forked from mislav/_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:

@yoshuawuyts
yoshuawuyts / modules.md
Last active August 29, 2015 14:15 — forked from mattdesl/modules.md
@yoshuawuyts
yoshuawuyts / README.md
Last active August 29, 2015 14:15 — forked from andyshinn/README.md

Terraform, CoreOS, and Digital Ocean

Let's use Terraform to easily get a CoreOS cluster up on Digital Ocean. In this example we will get a 5 node CoreOS cluster up and running on the Digital Ocean 8GB size.

Install Terraform

Grab a copy of Terraform for your platform from http://www.terraform.io/downloads.html. Follow the instructions at http://www.terraform.io/intro/getting-started/install.html by getting Terraform in your PATH and testing that it works.

Digital Ocean API Key

@yoshuawuyts
yoshuawuyts / wercker.yml
Last active August 29, 2015 14:16 — forked from eddie/wercker.yml
box: wercker/nodejs
# Build definition
build:
# The steps that will be executed on build
steps:
- script:
name: Reduce NPM cache time
code: npm config set cache-lock-stale 10000
// stepper.js
// 2015 cloudbender
// iojs 1.0.2
// generator works and steps itself,
// from the event loop;
process.on( 'exit', function(){console.log('bye');} );
(function main(){
@yoshuawuyts
yoshuawuyts / cliclock.sh
Last active August 29, 2015 14:16 — forked from Goles/cliclock.sh
#!/bin/sh
# Command-line world clock
# Taken from http://stackoverflow.com/questions/370075/command-line-world-clock
# .worldclock.zones file looks like:
# US/Pacific
# Europe/Berlin
# Chile/Continental
: ${WORLDCLOCK_ZONES:=$HOME/.worldclock.zones}