Skip to content

Instantly share code, notes, and snippets.

Avatar

Jeremiah Roth rothwerx

View GitHub Profile
@rothwerx
rothwerx / gist:6128390
Created Aug 1, 2013
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.
View gist:6128390
<?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 Sep 9, 2013
Bash: Deal with it
View gist:6499935
function dealwithit() {
echo "( °_°)"
sleep 1
tput cuu1
tput el
echo "( °_°)‿‑●‑●"
sleep 2
tput cuu1
tput el
echo "(‑●‑●)>"
@rothwerx
rothwerx / gist:6574543
Last active Dec 23, 2015
Bash: Animated dance. Useful for your celebrating when your multi-pipe one-liner works on the first try.
View gist:6574543
function _totheleft() {
echo "(°_°)"
echo "<) )╯"
echo ' / \'
}
function _totheright() {
echo " (°_°)"
echo "\( (>"
echo ' / \'
@rothwerx
rothwerx / gist:7146476
Created Oct 24, 2013
Go: Small example of running system commands
View gist:7146476
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 Apr 11, 2014
Python: Raspberry Pi: Read photocell values and graph with Graphite. I used this with cron for determining the best place to grow tomatoes.
View gist:10440939
!/usr/bin/env python
import RPi.GPIO as GPIO
import datetime
import socket
import time
import os
metric_path = "sun.loc1"
View gist:d206b61f91526742e5e7
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 Dec 9, 2014
ISC DHCP configuration that updates Windows DDNS
View gist:3392745ab7bef150a73a
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 Dec 14, 2014
Get the install date of a linux system
View gist:c894bd8b08fee8ab1a53
tune2fs -l /dev/sda1 | awk -F" +" '/Filesystem created/ { print $2 }'
View gist:4bfc8ce77c23e788d4a0
#!/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
View gist:700f275d078b3483509f
// 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
You can’t perform that action at this time.