Skip to content

Instantly share code, notes, and snippets.

View ahendrix's full-sized avatar

Austin Hendrix ahendrix

View GitHub Profile
# A chef definition for installing kernel modules on ubuntu/debian.
define :kernel_module, :action => :install do
if params[:action] == :install
bash "modprobe #{params[:name]}" do
code "modprobe #{params[:name]}"
not_if "lsmod |grep #{params[:name]}"
end
bash "install #{params[:name]} in /etc/modules" do
@ahendrix
ahendrix / vmstat.py
Last active December 25, 2015 20:29
reformat vmstat
#!/usr/bin/env python
import sys
import subprocess
def main():
if len(sys.argv) > 1:
time = sys.argv[1]
else:
time = "1"
@ahendrix
ahendrix / gist:7030300
Created October 17, 2013 18:56
bash stacktrace
function errexit() {
local err=$?
set +o xtrace
local code="${1:-1}"
echo "Error in ${BASH_SOURCE[1]}:${BASH_LINENO[0]}. '${BASH_COMMAND}' exited with status $err"
# Print out the stack trace described by $function_stack
if [ ${#FUNCNAME[@]} -gt 2 ]
then
echo "Call tree:"
for ((i=1;i<${#FUNCNAME[@]}-1;i++))
@ahendrix
ahendrix / gist:6004370
Created July 15, 2013 23:20
Install python scripts in catkin.
file(GLOB PYTHON_SCRIPTS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/*")
install(PROGRAMS ${PYTHON_SCRIPTS}
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
@ahendrix
ahendrix / gist:5499335
Created May 2, 2013 00:13
catkin makefile
all:
catkin_make
.PHONY: all
test:
catkin_make run_tests
.PHONY: test
install:
catkin_make install