Skip to content

Instantly share code, notes, and snippets.

@kevonc
kevonc / gist:9301174
Created March 2, 2014 02:52
One-line batch file rename
To Change [1] to .jpg in all your files
First, lets display the output to make sure it is correct
ls * | awk '{print("mv "$1" "$1)}' | sed 's/\[1\]/.jpg/2'
If it looks right, pipe the output to shell to execute
ls * | awk '{print("mv "$1" "$1)}' | sed 's/\[1\]/.jpg/2' | /bin/sh
@kevonc
kevonc / gist:9478886
Created March 11, 2014 03:21
bash script to find parent dir path
PROJECT_DIR="$( cd "$( dirname "${BASH_SOURCE}" )/.." && pwd )"
@kevonc
kevonc / gist:9758807
Created March 25, 2014 10:28
aws s3 bucket public policy
{
"Version": "2008-10-17",
"Id": "Policy1395742968152",
"Statement": [
{
"Sid": "Stmt1395742934142",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
@kevonc
kevonc / gist:719e128abbac2c28aa8b
Last active August 29, 2015 14:02
terminal - show computer, path, git branch, and # of commits for pushing or pulling
# source this file
wget https://github.com/ktaragorn/dotfiles/blob/master/bashrc.d/scm_ps1
brew install bash-completion
# copy into bash_profile
source scm_ps1
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
@kevonc
kevonc / gist:79ca1167c12b1d8da917
Last active August 29, 2015 14:10
Install A Great Dev Machine!
#1 - Install Thoughtbot's script
https://github.com/thoughtbot/laptop
#2 - iTerm2 / byobu
- Download iTerm2 Solarized Dark
- https://github.com/mbadolato/iTerm2-Color-Schemes
http://fideloper.com/mac-vim-tmux
http://www.sitepoint.com/tmux-a-simple-start/
https://gist.github.com/simme/1297707
http://www.linux.com/learn/tutorials/623327-enhancing-virtual-terminals-with-byobu