Skip to content

Instantly share code, notes, and snippets.

View rothwerx's full-sized avatar

Jeremiah Roth rothwerx

View GitHub Profile
@rothwerx
rothwerx / gist:6128390
Created August 1, 2013 04:21
PHP: Custom Drupal (5) module for Bronto email APIv4. Only putting it here because the internet lacks good examples of the Bronto API. Add error handling as needed.
<?php
function bronto_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'admin/mymodule/settings/bronto',
'access' => user_access('administer site configuration'),
'title' => t('Bronto settings'),
@rothwerx
rothwerx / gist:6499935
Created September 9, 2013 18:57
Bash: Deal with it
function dealwithit() {
echo "( °_°)"
sleep 1
tput cuu1
tput el
echo "( °_°)‿‑●‑●"
sleep 2
tput cuu1
tput el
echo "(‑●‑●)>"
@rothwerx
rothwerx / gist:6574543
Last active December 23, 2015 03:39
Bash: Animated dance. Useful for your celebrating when your multi-pipe one-liner works on the first try.
function _totheleft() {
echo "(°_°)"
echo "<) )╯"
echo ' / \'
}
function _totheright() {
echo " (°_°)"
echo "\( (>"
echo ' / \'
@rothwerx
rothwerx / gist:7146476
Created October 24, 2013 22:48
Go: Small example of running system commands
package main
import "os/exec"
import "fmt"
import "bytes"
func main() {
cmd := exec.Command("/bin/ls", "-al")
var out bytes.Buffer
cmd.Stdout = &out
@rothwerx
rothwerx / gist:10440939
Created April 11, 2014 04:31
Python: Raspberry Pi: Read photocell values and graph with Graphite. I used this with cron for determining the best place to grow tomatoes.
!/usr/bin/env python
import RPi.GPIO as GPIO
import datetime
import socket
import time
import os
metric_path = "sun.loc1"
set nocompatible
if has("syntax")
syntax on
endif
if has("autocmd")
" Automatically reload vimrc after saving
autocmd bufwritepost .vimrc source $MYVIMRC
" Remember last position in file
@rothwerx
rothwerx / gist:3392745ab7bef150a73a
Created December 9, 2014 16:48
ISC DHCP configuration that updates Windows DDNS
isc-dhcpd-4.1.1-P1
authoritative;
option domain-name "int.domain.com";
option domain-search "int.domain.com";
option domain-name-servers 10.50.10.74, 10.50.10.75, 10.50.10.20, 10.50.10.21;
ddns-updates on;
ddns-update-style interim;
update-static-leases on;
@rothwerx
rothwerx / gist:c894bd8b08fee8ab1a53
Created December 14, 2014 03:34
Get the install date of a linux system
tune2fs -l /dev/sda1 | awk -F" +" '/Filesystem created/ { print $2 }'
@rothwerx
rothwerx / gist:4bfc8ce77c23e788d4a0
Last active February 12, 2016 21:47
viminstall.sh
#!/bin/bash
# This file can be wget'ed at http://is.gd/vimme
realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
if ! command -v git; then
echo "You really need git."
exit 1
@rothwerx
rothwerx / gist:700f275d078b3483509f
Created January 4, 2015 21:05
8x8 bit matrix characters
// These were written specifically for the Adafruit 8x8 LED matrix,
// https://www.adafruit.com/product/870 but they could be used anywhere you need
// 64 bit character representations. I wasn't happy with any of the characters I
// found, so I created these. They're nice and bold, not silly line letters.
B00110000,B01111000,B11001100,B11001100,B11111100,B11001100,B11001100,B00000000,25, // A
B11111100,B01100110,B01100110,B01111100,B01100110,B01100110,B11111100,B00000000,25, // B
B00111100,B01100110,B11000000,B11000000,B11000000,B01100110,B00111100,B00000000,25, // C
B11111000,B01101100,B01100110,B01100110,B01100110,B01101100,B11111000,B00000000,25, // D
B11111110,B01100010,B01101000,B01111000,B01101000,B01100010,B11111110,B00000000,25, // E