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:3392745ab7bef150a73a
option domain-name "";
option domain-search "";
option domain-name-servers,,,;
ddns-updates on;
ddns-update-style interim;
update-static-leases on;
View gist:c894bd8b08fee8ab1a53
tune2fs -l /dev/sda1 | awk -F" +" '/Filesystem created/ { print $2 }'
View gist:700f275d078b3483509f
// These were written specifically for the Adafruit 8x8 LED matrix,
// 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
View gist:97c8c591be1021522b60
function resample() {
while read line; do
[[ $sample_interval -eq $ctr ]] && echo "$line" && ctr=0
done < <(echo "$fh")
View gist:065fbdfd5eec6aa56e1f
/* CPU values in /proc/stat are measured in USER_HZ which is
generally 1/100th of a second, but you can verify with this.
#include <unistd.h>
#include <stdio.h>
int main()
printf("USER_HZ is %d\n", sysconf(_SC_CLK_TCK));
View gist:b60f1fa7b543e8761b3c
# function to expand the range of allowed CPUs
range_expand () (
set -- $1
for element; do
if [[ $element =~ ^(-?[0-9]+)-(-?[0-9]+)$ ]]; then
set -- "$@" $(eval echo "{${BASH_REMATCH[1]}..${BASH_REMATCH[2]}}")
View gist:e1308d61512d7c278268
# Produce custom facts about HBA/HCA cards for facter
# This file should be executable in /etc/facter/facts.d/
# Look for Mellanox, Emulex, and QLogic cards
varq=$(lspci | awk '/[Mm]ellanox/ {
printf "mellanox=%s\n", $1 }
/[Ee]mulex/ {
printf "emulex=%s\n", $1 }
/[Qq][Ll]ogic/ {
View gist:7aa31f5437a4fc2b9416
function pecho {
if [[ $LOGGING ]]; then
printf "$@" | tee -a some.log
printf "$@"
pecho "%-10s %10s\n" "Logging:" "On"
View gist:f1843fe5e295f0c18d21
#!/usr/bin/env python
import yaml
import json
import sys
with open(sys.argv[2], "w") as outf, open(sys.argv[1]) as inf:
o = yaml.safe_load(inf)
json.dump(o, outf)