-
Notifications
You must be signed in to change notification settings - Fork 1
/
functions
64 lines (49 loc) · 1.56 KB
/
functions
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
#!/usr/bin/env bash
#create a new directory and enter it
function md() {
mkdir -p "$@" && "$@"
}
#function code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCodeInsiders" --args $*; }
# Change working directory to the top-most Finder window location
function cdf() { # short for `cdfinder`
cd "$(osascript -e 'tell app "Finder" to POSIX path of (insertion location as alias)')";
}
function myTest () {
echo "Test worked"
}
# animated gifs from any video
# from alex sexton gist.github.com/SlexAxton/4989674
# turn that video into webm.
# brew reinstall ffmpeg --with-libvpx
webmify(){
ffmpeg -i "$1" -vcodec libvpx -acodec libvorbis -isync -copyts -aq 80 -threads 3 -qmax 30 -y "$2" "$1.webm"
}
fh() {
eval $( ([ -n "$ZSH_NAME" ] && fc -l 1 || history) | fzf +s --tac | sed 's/ *[0-9]* *//')
}
pkgsign(){
productsign --sign "Developer ID Installer: Tim Fitzgerald (3289N5S57Z)" $1 $1.signed
}
aws_profiles() {
export AWS_PROFILE="$(cat ~/.aws/config | fzf -f [ | sed 's/[][]//g' | sed 's/profile //g'| fzf)"
}
aws_profiles_2() {
profiles_array=()
while read line; do
if [[ $line == "["* ]]; then
str_line=$(sed 's/[][]//g' <<< $line);
str_line=$(sed 's/profile //g' <<< $str_line);
profiles_array+=("$str_line");
fi
done < ~/.aws/credentials
while read line; do
if [[ $line == "["* ]]; then
str_line=$(sed 's/[][]//g' <<< $line);
str_line=$(sed 's/profile //g' <<< $str_line);
profiles_array+=("$str_line");
fi
done < ~/.aws/config
export AWS_PROFILE="$(printf "%s\n" "${profiles_array[@]}" | fzf)"
}
zle -N fh
bindkey '^r' fh