-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions
47 lines (40 loc) · 1.13 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
# vi: ft=bash
# creates a directory and immediately change to it
function mkcd() {
mkdir -p "$1" && cd "$1"
}
# lists installed homebrew packages along with their dependencies
function brew-tree() {
brew list | while read cask
do echo -n $fg[blue] $cask $fg[white]
brew deps $cask | awk '{printf(" %s ", $0)}'
echo ""
done
}
# restarts coreaudio
function restart-audio() {
sudo kill -9 `ps ax|grep 'coreaudio[a-z]' | awk '{print $2}'`
}
# removes all ds_store files, recursively
function rm-dsstore() {
find . -d -name ".DS_Store" -exec rm -v {} \;
}
# prints any git conflict lines in all files in the project
function git-conflicts() {
ag -r '(>{7})|(<{7})'
}
# lists all aws ec2 instances
function list-aws-instances() {
local region="$1"
aws ec2 describe-instances \
--region ${region:-`aws configure get region`} \
--query='Reservations[*].Instances[*].[PublicIpAddress, InstanceId, Tags[?Key==`Name`].Value | [0]]' \
--output table
}
function clean-after-pr() {
local name=`git rev-parse --abbrev-ref HEAD`
git checkout main
git pull
git push --no-verify origin :$name
git branch -d $name
}