Skip to content

Instantly share code, notes, and snippets.

View quickshiftin's full-sized avatar

Nathan Nobbe quickshiftin

View GitHub Profile
@quickshiftin
quickshiftin / git-transmit
Last active January 1, 2020 16:00 — forked from subtleGradient/git-transmit
Checkout this approach for knowing what to transfer. This revision uses a local tag to track each time you use the command. The first time you use it, it pushes all files in the project. At the end of each run it updates the tag to point to HEAD. Next time you run it, it will only push files that have changed since the last push.
#!/usr/bin/env bash
# author: Thomas Aylott SubtleGradient.com
# author: Nathan Nobbe quickshiftin.com
# Find out where HEAD is pointing
head_ref=$(git show-ref --head -s | head -n 1)
# Check to see if transmit tag exists, and get transmit tag hash
_transmit_ref=$(git show-ref --verify -s refs/tags/transmit)
# If there's not transmit tag, create it for the first time.
@quickshiftin
quickshiftin / lastd.sh
Created February 10, 2014 19:35
BASH alias to get the last downloaded file on OSX
alias lastd='echo ~/Downloads/$(ls -t ~/Downloads/ | head -n 1)'
@quickshiftin
quickshiftin / git-find-replace.sh
Last active August 29, 2015 13:56
Simple git find-&-replace utility (for use w/ GNU sed)
#--------------------------------------------------------
# Simple search and replace utility for git repositories.
# @note Use w/ GNU sed.
# (c) Nathan Nobbe 2014
# quickshiftin@gmail.com
# http://quickshiftin.com
# $1 - Search
# $2 - Replace
# $3 - Subdirectory (optional, defaults to cwd)
#--------------------------------------------------------
@quickshiftin
quickshiftin / mysqldbs.sh
Last active August 29, 2015 13:56
mysqldbs - Show all mysql databases for a given host (defaults to localhost) a given user can view with a simple Bash alias.
alias mysqldbs='_() { local h=""; if [ ! -z "$2" ]; then h="-h$2"; fi; echo "show databases;" | mysql -u "$1" "$h" -p; }; _'
@quickshiftin
quickshiftin / phplint.sh
Last active August 29, 2015 13:56
The lint utility you wish `php -l` was out of the box. Lint check multiple PHP files with a single command.
function php_lint
{
for arg in $(seq $#)
do
# Use find to iterate over directories recursively
if [ -d "${!arg}" ]; then
find "${!arg}" -name '*.php' -exec php -l "{}" ";"
# Just run normal files and symlinks through php -l individually
elif [ -f "${!arg}" -o -h "${!arg}" ]; then
php -l "${!arg}"
@quickshiftin
quickshiftin / jetty-hash-pass.sh
Last active August 29, 2015 13:56
A thin wrapper around a jetty utility to hash passwords for xml files.
#!/bin/bash
# -----------------------------------------------------------------------------------
# jetty-hash-pass.sh
# (c) Nathan Nobbe 2014
# quickshiftin@gmail.com
# http://quickshiftin.com
#
# See the Password Issues section of the below link
# http://docs.codehaus.org/display/JETTY/How+to+configure+SSL#HowtoconfigureSSL-step3
#
@quickshiftin
quickshiftin / pem2pkcs12.sh
Created February 12, 2014 05:03
Convert a set of Apache ssl certificates to a format suitable for Jetty
#!/bin/bash
# -----------------------------------------------------------------------------------
# pem2pkcs12.sh
# (c) Nathan Nobbe 2014
# quickshiftin@gmail.com
# http://quickshiftin.com
#
# Use this script to convert a set of apache ssl certificates to a format suitable
# for Jetty.
#
@quickshiftin
quickshiftin / osx-locate.sh
Created February 18, 2014 03:11
Simulate locate on OSX
# update locate database, linux style
alias updatedb='sudo /usr/libexec/locate.updatedb'
# mdfind is the locate equivalent on OSX,
# so this is probly more useful for you
alias locate='mdfind -name'
@quickshiftin
quickshiftin / lse.sh
Last active August 29, 2015 13:56
ls wrapper for emacs that omits files created by the editor
_lse_filter='~|#.*#'
alias lse='_() { ls -1 $1 | egrep -v $_lse_filter; }; _'
@quickshiftin
quickshiftin / osx-brew-gnu-coreutils-man.sh
Created February 21, 2014 07:25
Running GNU coreutils via Homebrew on your Mac? Here's a one-liner to get the manpages working!
# Short of learning how to actually configure OSX, here's a hacky way to use
# GNU manpages for programs that are GNU ones, and fallback to OSX manpages otherwise
alias man='_() { echo $1; man -M $(brew --prefix)/opt/coreutils/libexec/gnuman $1 1>/dev/null 2>&1; if [ "$?" -eq 0 ]; then man -M $(brew --prefix)/opt/coreutils/libexec/gnuman $1; else man $1; fi }; _'