-
Notifications
You must be signed in to change notification settings - Fork 0
/
.useful.zconfig
161 lines (139 loc) · 4.19 KB
/
.useful.zconfig
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
alias killn='killAll NotificationCenter'
alias pip='pip3'
alias python='python3'
alias chrome="/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome"
alias mvn-dependency="mvn org.owasp:dependency-check-maven:check"
alias less="less -FXS" # Make less output stay in terminal after quitting
alias ta=tmux a
alias ij="open -a 'IntelliJ IDEA CE.app'"
alias code="open -a 'Visual Studio Code.app'"
if type rg &> /dev/null; then
export FZF_DEFAULT_COMMAND='rg --files'
export FZF_DEFAULT_OPTS='-m --height 50% --border'
fi
function gitthis {
open "http://$(git remote get-url origin | cut -d '@' -f2 | tr ':' '/' | sed 's/\.git$//')"
}
function ggu() {
if [[ -z $1 ]] then
uuidgen | tr '[:upper:]' '[:lower:]' | tr -d '\n'
else
for ((i=1;i<=$1;i++)); do
uuidgen | tr '[:upper:]' '[:lower:]'
done
fi
}
# For some mad reason, ZSH fg doesn't do fg 1, you have to do
# fg %1 - this fixes that complete nonsense
function fg() {
if [[ $# -eq 1 && $1 = - ]]; then
builtin fg %-
else
builtin fg %"$@"
fi
}
function mcdir {
command mkdir $1 && cd $1
}
function newdesign() {
cp ~/.bin/dotfiles/drawio-template.drawio $1
}
function ff() {
vi $(fzf --multi | xargs)
}
IMPORT_MOTO_DIR="/Volumes/Colossus/6_Motorbike/"
IMPORT_G7XII_DIR="/Volumes/Colossus/7-pictures/cameras/canon-g7x-mkii/"
# Generate the name for the current import
function generate_import_folder() {
[[ -z $1 ]] && echo "Must provide description with no spaces" && return
local description=$1
date_prefix="$(date "+%F" | sed 's/-//g')-"
mkdir -pv "$IMPORT_MOTO_DIR$date_prefix$description"
open "$IMPORT_MOTO_DIR$date_prefix$description"
}
function generate_canon_import_folder() {
[[ -z $1 ]] && echo "Must provide description with no spaces" && return
local description=$1
date_prefix="$(date "+%F" | sed 's/-//g')-"
mkdir -pv "$IMPORT_G7XII_DIR$date_prefix$description"
open "$IMPORT_G7XII_DIR$date_prefix$description"
echo "$IMPORT_G7XII_DIR$date_prefix$description"
}
# Import everything from GoPro and ZoomH1
function import_everything() {
echo "importing from GoPro"
import_gopro $1 &
echo "importing from Zoom"
import_zoom $1 &
# echo "importing from Canon G7x Mkii"
# import_canon_g7xii $1 &
}
function import_gopro() {
folder=$(generate_import_folder $1)
}
function import_zoom() {
folder=$(generate_import_folder $1)
mv -v /Volumes/ZOOM/STEREO/FOLDER01/*.MP3 $folder
mv -v /Volumes/ZOOM/STEREO/FOLDER01/*.WAV $folder
mv -v /Volumes/ZOOM/STEREO/FOLDER01/*.wav $folder
compress_all $folder
}
function import_canon_g7xii() {
folder=$(generate_canon_import_folder $1)
echo $folder
mv -v /Volumes/CANON_DC/DCIM/*/*.CR2 $folder
mv -v /Volumes/CANON_DC/DCIM/*/*.MP4 $folder
cd $folder
#rename_shoot $1
echo $1
cd -
}
# Compresses all the files in a directory
function compress_all() {
local directory=$1
if [[ ! -z $1 ]] then
cd $directory
else
echo "No input directory provided using the current directory"
directory=$(basename `pwd`)
fi
for audio_file in $(ls | grep MP3 | grep -v compressored); do
echo "Compressing $audio_file"
output=$(echo $directory"_compressored_$audio_file" | sed 's/ZOOM//g')
ffmpeg -i $audio_file -af acompressor=threshold=-12dB:ratio=9:attack=200:release=1000 $output
done
[[ ! -z $1 ]] && cd -
}
# Adds a prefix to all files in a directory
function prefix_files() {
for f in * ; do prefix_file $1 ; done
}
# Adds a prefix to a single file
function prefix_file() {
mv -- "$f" "$1$f"
}
function rename_convention() {
rename 's/\. /-/' * && rename 's/ /-/g' * && rename 's/_/-/g' * \
&& rename 's/,//g' * \
&& rename 's/;//g' * \
&& rename "s/'//g" * \
&& rename 's/&/and/g' * \
&& rename --force 'y/A-Z/a-z/' *
}
function rename_shoot() {
prefix_files $1
rename_convention
}
function conda_init() {
__conda_setup="$('/opt/homebrew/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/opt/homebrew/anaconda3/etc/profile.d/conda.sh" ]; then
. "/opt/homebrew/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/opt/homebrew/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
}