11# list/describe ec2 instances in all the regions
22function ec2-list-all(){
3- for region in ` aws ec2 describe-regions --output text | cut -f3`
3+ for region in $( aws ec2 describe-regions --output text | cut -f3)
44 do
55 echo -e "\nListing Instances in region:'$region'..."
66 echo -e "https://console.aws.amazon.com/ec2/v2/home?region=$region"
7- aws ec2 describe-instances --region $region | jq '.Reservations[] | ( .Instances[] | {state: .State.Name, name: .KeyName, type: .InstanceType, key: .KeyName})'
7+ aws ec2 describe-instances --region " $region" | jq '.Reservations[] | ( .Instances[] | {state: .State.Name, name: .KeyName, type: .InstanceType, key: .KeyName})'
88 done
99}
1010
1111function svg-to-base64() {
12- echo "background: transparent url('data:image/svg+xml;base64," $(openssl base64 < $@)" ') no-repeat center center;"
12+ echo "background: transparent url('data:image/svg+xml;base64,$(openssl base64 < "$@") ') no-repeat center center;"
1313}
1414
1515function dj() {
@@ -32,7 +32,7 @@ function chpwd() {
3232# ------------------------------------------------------------------------------
3333
3434openssl-to-pem () {
35- openssl pkcs12 -in $1 -out $1.pem -nodes -clcerts
35+ openssl pkcs12 -in "$1" -out " $1.pem" -nodes -clcerts
3636}
3737
3838# ------------------------------------------------------------------------------
@@ -85,8 +85,8 @@ supertouch() {
8585
8686# Create a .tar.gz archive, using `zopfli`, `pigz` or `gzip` for compression
8787function targz() {
88- local tmpFile="${@ %/}.tar"
89- tar -cvf "${tmpFile}" --exclude=".DS_Store" "${@} " || return 1
88+ local tmpFile="${* %/}.tar"
89+ tar -cvf "${tmpFile}" --exclude=".DS_Store" "$@ " || return 1
9090
9191 size=$(
9292 stat -f"%z" "${tmpFile}" 2> /dev/null; # OS X `stat`
@@ -166,12 +166,12 @@ function fixcrlf(){
166166
167167# Create new directories and enter the first one
168168function md() {
169- mkdir -pv "$@" && cd "$1"
169+ mkdir -pv "$@" && cd "$1" || return
170170}
171171
172172# Copy w/ progress
173173cp_p () {
174- rsync -WavP --human-readable --progress $1 $2
174+ rsync -WavP --human-readable --progress "$1" "$2"
175175}
176176
177177# ------------------------------------------------------------------------------
@@ -210,7 +210,7 @@ function phpserver() {
210210# | Git |
211211# ------------------------------------------------------------------------------
212212
213- # function to normalize a crupt git repo
213+ # function to normalize a corrupt git repo
214214function git_normalize_eol(){
215215 echo "* text=auto" >>.gitattributes
216216 rm .git/index # Remove the index to force git to
@@ -222,12 +222,12 @@ function git_normalize_eol(){
222222}
223223
224224function gitignore() {
225- curl -s https://www.gitignore.io/api/$@;
225+ curl -s " https://www.gitignore.io/api/$*"
226226}
227227
228228
229229# take this repo and copy it to somewhere else minus the .git stuff.
230230function gitexport(){
231231 mkdir -p "$1"
232- git archive master | tar -x -C "$1"
232+ git archive HEAD | tar -x -C "$1"
233233}
0 commit comments