Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am brwyatt on github.
  • I am brwyatt (https://keybase.io/brwyatt) on keybase.
  • I have a public key whose fingerprint is 7139 4C8E CA4A B1BE B85E B202 B83E E2D5 5C50 C6B2

To claim this, I am signing this object:

@brwyatt
brwyatt / aliases.sh
Last active August 29, 2015 14:07
Handy Aliases for BASH
# Update all repositories under ~/repos.
# Works for SVN and GIT (very simplistic)
alias update-repos="ls ~/repos | xargs -I% bash -c 'echo -e \"\e[0;34mUpdating %\e[0m\"; cd ~/repos/% ; if [ -d .svn ]; then svn update; elif [ -d .git ]; then git fetch -v; else echo -e \"\e[0;31mNot a repo\e[0m\"; fi'"
# Calls `svn diff` and adds some color to the output to make changes stand out
alias colordiff="svn diff | sed -E 's/^(@@.*@@)$/\x1b[0;34m\1\x1b[0m/' | sed -E 's/^(Index: .*|=*)$/\x1b[0;33m\1\x1b[0m/' | sed -E 's/^(\+.*)$/\x1b[0;32m\1\x1b[0m/' | sed -E 's/^(\-.*)$/\x1b[0;31m\1\x1b[0m/' | less -R"
@brwyatt
brwyatt / GraphGit.sh
Last active March 17, 2016 09:15
Create a directed graph from a Git repo using dot
#!/usr/bin/env bash
# based on http://chiu01.blogspot.com/2012/04/git-tip-using-graphviz-to-display.html
# Use: ./GraphGit.sh [FromCommitish] [ToCommitish]
echo 'digraph "git" {' > graph.dot
git log --pretty='format: %h [label="%h\n%an <%ae>\n%ai\n%s" shape=box]' $1..$2 | perl -p -e 's/([0-9a-f]{7})/"\1"/' >> graph.dot
git log --pretty='format: %h -> { %p }' $1..$2 | perl -p -e 's/([0-9a-f]{7})/"\1"/g' >> graph.dot
echo '}' >> graph.dot
dot -Tpng graph.dot -o graph.png
@brwyatt
brwyatt / generatePassword.sh
Created April 29, 2014 19:28
Generate a 15-25 character password with lower/upper-case, numbers, -, and _
#!/bin/bash
cat /dev/urandom|tr -dc 'a-zA-Z0-9_-'|fold -w$(echo "($RANDOM%10)+15"|bc)|head -n1
@brwyatt
brwyatt / generatePassphrase.sh
Last active August 29, 2015 14:00
Generate a 4-6 word passphrase similar to https://xkcd.com/936/
#!/bin/bash
WORDLIST=$(grep -iv '[^abcdefghijklmnopqrstuvwxyz]' /usr/share/dict/words)
COUNT="$(echo "($RANDOM%3)+4"|bc)"
WORDCOUNT="$(echo "$WORDLIST"|wc -l)"
LC_CTYPE=C
x=0
while [ $x -lt $COUNT ]; do
@brwyatt
brwyatt / LinkShortener.pl
Last active December 29, 2015 21:19
An irssi script to shorten long links using brwyatt.net (my personal site)
#!/usr/bin/perl -w
use strict;
use Irssi;
require LWP::UserAgent;
use vars qw($VERSION %IRSSI);
$VERSION = "0.1";
%IRSSI = (