This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# change default shell to zsh (asks for password) | |
chsh -s /bin/zsh | |
# install xcode command line tools | |
xcode-select --install | |
# download my custom .zshrc | |
curl https://gist.githubusercontent.com/simonhaenisch/382eab0cfa3435dad7e177a49fe198fc/raw/.zshrc > ~/.zshrc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# --------------------------------------------------------------------------- | |
# | |
# Description: This file holds all my BASH configurations and aliases. | |
# Much of this was originally copied from: | |
# http://natelandau.com/my-mac-osx-bash_profile/ | |
# | |
# Sections: | |
# 1. Environment Configuration | |
# 2. Make Terminal Better (remapping defaults and adding functionality) | |
# 3. File and Folder Management |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
color_0 = ffff ffff ffff | |
color_1 = 4949 4848 3e3e | |
color_2 = 6666 d9d9 efef | |
color_3 = 6b6b c7c7 2b2b | |
color_4 = fdfd 9797 1f1f | |
color_5 = f9f9 2626 7272 | |
color_6 = 94bc 5925 ffff | |
color_7 = 7575 7171 5e5e | |
color_8 = e6e6 dbdb 7474 | |
color_9 = a6a6 e2e2 2e2e |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo sweep -di -dn / | |
Password: | |
Sophos Anti-Virus | |
Version 9.6.1 [Darwin/AMD64] | |
Virus data version 5.40, May 2017 | |
Includes detection for 13427651 viruses, trojans and worms | |
Copyright (c) 1989-2017 Sophos Limited. All rights reserved. | |
System time 13:08:55, System date 16 June 2017 | |
Command line qualifiers are: -di -dn |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# echo URL | googl | |
function googl { | |
local url=$(cat <&0) | |
( | |
set -e pipefail; | |
echo "{}" \ | |
| json -e "this.longUrl='$url'" \ | |
| curl -sf https://www.googleapis.com/urlshortener/v1/url \ | |
-H 'Content-Type: application/json' -d@- \ | |
| json id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Usage: goo.gl [URL] | |
# | |
# Shorten a URL using the Google URL Shortener service (http://goo.gl). | |
goo.gl() { | |
[[ ! $1 ]] && { echo -e "Usage: goo.gl [URL]\n\nShorten a URL using the Google URL Shortener service (http://goo.gl)."; return; } | |
curl -qsSL -m10 --connect-timeout 10 \ | |
'https://www.googleapis.com/urlshortener/v1/url' \ | |
-H 'Content-Type: application/json' \ | |
-d '{"longUrl":"'${1//\"/\\\"}'"}' | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### List of Bash Aliases | |
## Hard Drive and Directory space commands | |
alias ls-space='echo "Displaying Disk space used per directory..." && du -slh * | sort -h' | |
alias ls-hdspace='echo "Displaying Hard Drive space used and available" && df -H && echo "Script complete. Press Enter to continue"' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# SYPOPSIS: Rename files in folder to match folder. | |
# CREDIT: Unamed user on superuser or superadmin. If you find this, let me know and I will add you to the credits. | |
# UPCOMING: Allow for secondary input such as `rename-files-to-folder $MOVIENAME` so not to rename all movies in directory just one or two. | |
find * -type f -maxdepth 1 | while read file | |
do | |
dirname="$(dirname "$file")" | |
new_name="${dirname##*/}" | |
file_ext=${file##*.} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# SYNOPSIS: Move a TV Show or Movie directory to another folder or drive | |
# USAGE: | |
# NOTES: The Function cp_p was discovered on StackExchange at http://j.mp/1OOqAV1. | |
#cp_p() | |
#{ | |
# strace -q -ewrite cp -- "${1}" "${2}" 2>&1 \ | |
# | awk '{ | |
# count += $NF |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# SYNOPSIS: Rename all files in folder to match folder name. | |
# Testing 1 | |
# rename -vn 's:(/[^/]*)/[^/]*$:$1$1.mkv:' folder/*/*.mkv | |
# Testing 2 | |
#for f in folder/*/*.mkv;do dn="${f%/*}";echo mv -v "$f" "${dn}/${dn##*/}.mkv";done | |
# Testing #3 |