-
Notifications
You must be signed in to change notification settings - Fork 0
/
common
103 lines (80 loc) · 2.68 KB
/
common
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Text editor stuff
export EDITOR="$HOME/bin/subl"
# Start Visual Studio Code
code () {
if [[ $# = 0 ]]
then
open -a "Visual Studio Code"
else
[[ $1 = /* ]] && F="$1" || F="$PWD/${1#./}"
open -a "Visual Studio Code" --args "$F"
fi
}
# nice directory listing
alias ls='ls -FGah'
# nice PATH
alias path='echo -e ${PATH//:/\\n}'
# open current directory in Finder
alias f='open .'
# HTTP serve current directory
alias https="python -m SimpleHTTPServer"
# alias https='ruby -run -ehttpd . -p8000'
# Recursively delete `.DS_Store` files
alias cleanup="find . -name '*.DS_Store' -type f -ls -delete"
# Recursively remove svn metadata
alias unsvn="find . -type d -name .svn -exec rm -rf {} \;"
# Recursively remove git metadata
alias ungit="find . -type d -name .git -exec rm -rf {} \;"
# Misc aliases
alias brain='subl ~/Dropbox/Braindump/Braindump.sublime-project'
alias svn18="/usr/local/opt/[email protected]/bin/svn"
alias blender='/Applications/blender-2.79/blender.app/Contents/MacOS/blender'
# shortcut to common directories
function d { cd ~/Downloads/$1; }
function p { cd ~/Projects/$1; }
function wr { cd ~/Work/$1; }
function sen { cd ~/Work/Sentiomedia/$1; }
# create directory and enter it
function mkcdr {
mkdir -p $1
cd $1
}
# list brews you need to install on a clean machine
brews () {
for name in $(brew leaves); do
brew info $name | awk '{ if (NR==1) {printf "%s ", $1}; if (NR==2) {print}; }';
done
}
# shorter info for NPM package
function npmi() { npm info $1 | grep 'description\|homepage\|author'; }
# quick imagemagick functions to convert screenshot
function shot2jpg() {
convert "$@" -background white -alpha remove -strip -quality 90 "${@%.*}.jpg"
}
function shot2jpg50() {
convert "$@" -scale 50% -background white -alpha remove -strip -quality 90 "${@%.*}.jpg"
}
function shot2jpg75() {
convert "$@" -scale 75% -background white -alpha remove -strip -quality 90 "${@%.*}.jpg"
}
alias localip='ifconfig | grep "inet "'
function myip() {
internalip=`ifconfig | ruby -e "print STDIN.readlines.select { |a| a =~ /inet / }.reject { |a| a =~ /127/ }.map { |a| a.split(' ')[1] }.join(', ')"`
externalip=`curl -s https://jsonip.com | jq -r .ip | tr -d '\n'`
echo "Internal: $internalip"
echo "External: $externalip"
echo -n $externalip | pbcopy
}
# THE PATH
PATH="$HOME/Projects/scripts:$HOME/bin:$PATH"
##Renderman
# RMANTREE="/Applications/Pixar/RenderManProServer-21.3"
# PATH="$PATH:$RMANTREE/bin"
##Houdini Environment Setup
# cd '/Applications/Houdini/Current/Frameworks/Houdini.framework/Versions/Current/Resources'
# source ./houdini_setup
# cd -
## MySQL
PATH="/usr/local/mysql/bin:$PATH"
# disable dotNet telemetry
export DOTNET_CLI_TELEMETRY_OPTOUT=1