Skip to content

Instantly share code, notes, and snippets.

@btcrooks
btcrooks / Date As Filename.sh
Created January 1, 2016 01:11
Set a file's creation date as it's filename
#!/usr/bin/env bash
#
# Retrievs a file's modified date and
# set's it as it's fielname.
#
declare -a files="${1}"
## Check if file has been specified
if [[ -z ${files} ]]; then
echo "No file(s) specified"
@btcrooks
btcrooks / Vim 7_4.sh
Last active December 12, 2015 21:48
Install vim 7.4.x
# 1) Install vim 7.4.x through homebrew
# $ brew install vim
# 2) Override default vim installation by creating
# aliases in your respective shell's dotfiles.
# (e.g. '.bash_profile', '.bashrc')
alias vim="/usr/local/Cellar/vim/7.4.944/bin/vim"
alias vi="/usr/local/Cellar/vim/7.4.944/bin/vim"
alias vimtutor="/usr/local/Cellar/vim/7.4.944/bin/vimtutor"
alias vimdiff="/usr/local/Cellar/vim/7.4.944/bin/vimdiff"
@btcrooks
btcrooks / Exit Status.sh
Last active December 6, 2015 06:19
Capture and return the exit status
#!/usr/bin/env bash
#
# @description: Capture and return the exit status
#
function exitStatus() {
"${1}" "${2}" >/dev/null ; echo $?;
}
## Test all the things!!
@btcrooks
btcrooks / Check Command.sh
Last active December 6, 2015 05:55
This script takes multiple arguments and checks if those commands exist.
#!/usr/bin/env bash
#
# @description: This script takes multiple commands as arguments
# and checks if those commands exist on the system.
# Tested on bash, zsh, & ksh.
#
declare -a programs=("$@")
for i in "${programs}"; then
@btcrooks
btcrooks / Bash Color Commands
Last active August 29, 2015 14:09
Color Commands for Shell Scripting (Bash)
#!/bin/sh
# Here are a set of color commands for
# your shell scripts.
#----------------Colors------------------
#Black 0;30 Dark Gray 1;30
#Blue 0;34 Light Blue 1;34
#Green 0;32 Light Green 1;32
#Cyan 0;36 Light Cyan 1;36