Skip to content

Instantly share code, notes, and snippets.

View adamjstewart's full-sized avatar

Adam J. Stewart adamjstewart

View GitHub Profile
@adamjstewart
adamjstewart / Makefile
Last active February 9, 2019 19:32
Makefile for building Graphviz graphs
SRC := $(wildcard *.dot *.gv)
CMD := dot
.PHONY: help Makefile
# Put it first so that "make" without argument is like "make help".
help:
@echo Usage:
@echo
@adamjstewart
adamjstewart / bash-paths.sh
Created October 2, 2016 17:15
Bash relative vs. absolute paths
#!/usr/bin/env bash
# There are many ways to get a path to a file or script.
# This script showcases several of them and their pitfalls.
# Credit for most of these techniques comes from:
# http://stackoverflow.com/questions/4774054/
abs_path='/usr/bin/bash'
rel_path='.'
@adamjstewart
adamjstewart / cvs-login.exp
Last active July 30, 2016 13:26
Automate login to multiple CVS repositories
#!/usr/bin/env expect
# Automates CVS login to ocr, hwr, and rcr.
# Prompts user for password a single time.
# Turn off timeout
set timeout -1
# Ask user for password
stty -echo; # make sure password isn't echo'ed
@adamjstewart
adamjstewart / bash-booleans.sh
Last active July 30, 2016 14:10
Bash boolean examples
#!/usr/bin/env bash
# Various methods of using Booleans in Bash
# Credit for most of these techniques comes from:
# http://stackoverflow.com/questions/2953646/
###########################################################
# Using the builtin 'true' and 'false' commands
###########################################################
@adamjstewart
adamjstewart / bash-functions.sh
Last active October 2, 2016 16:12
Bash function body delimiters
#!/usr/bin/env bash
# Bash function bodies can be delimited by curly braces,
# but they don't have to be. The following are all valid
# function body delimiters:
#
# arithmetic: ((expression))
# test: [[ expression ]]
# subshell: (list)
# group: { list }