Skip to content

Instantly share code, notes, and snippets.

function j() {
path=`(cat ~/bashmarks && find /home/jeroen/Projecten/ -maxdepth 3 -type d -not -path '*/\.*') | fzf --extended --query="$1" --select-1`
if [ $? -eq 0 ]; then
cd "$path"
fi
}
@teranex
teranex / bash-jump.sh
Last active January 25, 2016 10:48
Jump function for bash
function j() {
path=`(cat ~/bashmarks && find /home/jeroen/Projecten/ -maxdepth 3 -type d -not -path '*/\.*') | fzf --extended --query="$1" --select-1`
if [ $? -eq 0 ]; then
cd "$path"
fi
}
# ~/bashmarks is just a list of directories
# fzf can be found here: https://github.com/junegunn/fzf
@teranex
teranex / keybase.md
Created October 20, 2014 11:05
keybase.md

Keybase proof

I hereby claim:

  • I am teranex on github.
  • I am teranex (https://keybase.io/teranex) on keybase.
  • I have a public key whose fingerprint is 03E2 547D 5CE5 DEF7 5C85 9280 B990 30C6 610D B834

To claim this, I am signing this object:

@teranex
teranex / convert-to-chromecast
Created September 12, 2014 08:21
Convert a video file to a MKV playable directly on a Chromecast. Usage: `./convert-to-chromecast /path/to/video.file`
#!/bin/bash
if ffmpeg -i "$1" 2>&1 | grep Video: | grep h264 #check video codec
then
vcodec=copy
else
vcodec=libx264
fi
if ffmpeg -i "$1" 2>&1 | grep Video: | grep "High 10" #10 bit H.264 can't be played by Hardware.
@teranex
teranex / gi.sh
Created February 26, 2013 16:16
I often type `gi tcommand` instead of `git command`. This little script corrects that typo. To use: add it as 'gi' somewhere to your $PATH and it executable.
#!/bin/bash
# if the first argument starts with a t, we actually meant to execute git
first=$1
if [ "t" == "${first:0:1}" ]
then
# remove the first argument
shift
# the pass everything to git, while removing the initial 't' from the first argument
git ${first:1:${#first}-1} $*
@teranex
teranex / repeat-punisher.vim
Created January 20, 2013 14:23
This is a vim plugin I started writing to 'unlearn' repeatedly hitting the j and k keys to move vertically across the screen. I didn't finish it however, so I'm just making it public here, should it be useful for anybody...
let g:punisher_keys = ['j', 'k', 'h', 'l', 'dd', 'x', 'X']
let g:punisher_max_repeats = 4
let g:punisher_mode = 'normal' " normal, hard, extreme, low
" TODO:
" - dot-command fixen
" - config options
" - arrows etc
" - arrows in insert mode
" - hard en extreme mode
@teranex
teranex / vimlog
Created March 6, 2012 10:53
Vimlog when running Vim 7.2 on Maemo 5 with Neocomplcache enabled
sourcing "$VIM/vimrc"
line 4: sourcing "/usr/share/vim/vim72/syntax/syntax.vim"
Searching for "syntax/synload.vim" in "/home/user/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/usr/share/vim/vimfiles/after,/home/user/.vim/after"
Searching for "/home/user/.vim/syntax/synload.vim"
Searching for "/usr/share/vim/vimfiles/syntax/synload.vim"
Searching for "/usr/share/vim/vim72/syntax/synload.vim"
line 19: sourcing "/usr/share/vim/vim72/syntax/synload.vim"
Searching for "syntax/syncolor.vim" in "/home/user/.vim,/usr/share/vim/vimfiles,/usr/share/vim/vim72,/usr/share/vim/vimfiles/after,/home/user/.vim/after"
Searching for "/home/user/.vim/syntax/syncolor.vim"
@teranex
teranex / trexprompt.sh
Created April 18, 2011 21:38
My Bash prompt
#!/bin/bash
GIT_PS1_SHOWDIRTYSTATE=true
GIT_BRANCH_COLOR="\[\033[38;5;155m\]\[\033[48;5;235m\]"
PS1_EXIT_RED="\[\033[38;5;208m\]\[\033[48;5;52m\]"
# === Initializing static variables ===========================================
case $TERM in
xterm* | screen)
CORNER_TOP="\[\033(0l\033(B\]"