This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if [[ -z $PS1 ]] # no prompt? | |
| ### if [ -v PS1 ] # On Bash 4.2+ ... | |
| then # non-interactive | |
| ... | |
| else # interactive | |
| ... | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /usr/bin/plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist | grep -E -o '<string>http[s]{0,1}://.*</string>' | grep -v icloud | sed -E 's/<\/{0,1}string>//g' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| #http://getpocket.com/import/instapaper | |
| set -x | |
| cat >> /tmp/import.html << "EOF" | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
| <title>Instapaper: Export</title> | |
| </head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # alias last and save | |
| # use `als c NAME` to chop off the last argument (for filenames/patterns) | |
| als() { | |
| local aliasfile chop x | |
| [[ $# == 0 ]] && echo "Name your alias" && return | |
| if [[ $1 == "c" ]]; then | |
| chop=true | |
| shift | |
| fi | |
| aliasfile=~/.bash_it/aliases/custom.aliases.bash |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| inoremap <silent> <Bar> <Bar><Esc>:call <SID>align()<CR>a | |
| function! s:align() | |
| let p = '^\s*|\s.*\s|\s*$' | |
| if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p) | |
| let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g')) | |
| let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*')) | |
| Tabularize/|/l1 | |
| normal! 0 | |
| call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Add vi customization to less | |
| VLESS=$(find /usr/share/vim -name 'less.sh') | |
| if [ ! -z $VLESS ]; then | |
| alias less=$VLESS | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env zsh | |
| # | |
| # Sym-link files to the bin dotfiles directory | |
| # | |
| local dir_current="$(pwd)" | |
| local dir_bin="$HOME/.bin" | |
| for file in "$@" | |
| do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cdlink () { | |
| for f in "$@" | |
| do | |
| cd $f(:A:h) | |
| done | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| tell application "System Events" | |
| tell process "Finder" | |
| if window 1 exists then | |
| tell application "Finder" | |
| set thePath to get quoted form of POSIX path of (target of front Finder window as text) | |
| return "cd " & thePath & return | |
| end tell | |
| else | |
| display alert "Finder doesn't have a window open." as warning giving up after 2 | |
| end if |