Skip to content

Instantly share code, notes, and snippets.

View PhirePhly's full-sized avatar

Kenneth Finnegan PhirePhly

View GitHub Profile
@PhirePhly
PhirePhly / dlbell.sh
Created March 14, 2012 04:18
Downloads all of Bell System's Technical Journals
#!/bin/sh
#
# Kenneth Finnegan, 2012
# kennethfinnegan.blogspot.com
#
# Slowly download all Bell Systems technical articles
# Best to spin this off in the background or on a screen
alias slowget='wget --limit-rate=25k '
#!/usr/bin/env python
import paho.mqtt.client as mqtt
import RPi.GPIO as GPIO
def on_connect(client, userdata, rc):
#print ("Connected with rc: " + str(rc))
client.subscribe("kwf/demo/led")
def on_message(client, userdata, msg):
// Kenneth Finnegan, 2021
//
// Atmega328P on breadboard with 8MHz crystal. Use the mini pro 3.3V 8MHz board
//
// Pin 11 is the LED output
// Digital Pins 2-5 are DIP switch for time config on boot
// Reset button restarts the timer
// Using https://github.com/LowPowerLab/LowPower
#include <LowPower.h>
@PhirePhly
PhirePhly / create_raspbian_mirror.sh
Last active July 9, 2021 09:26
Mirroring script for Raspbian repos
#!/bin/bash
#
#
## Setting variables with explanations.
# Set root working directory for where you want to store your mirrors
MIRRORBASE=/home/kenneth/mirror
mkdir -p $MIRRORBASE
#
@PhirePhly
PhirePhly / init
Last active December 21, 2020 02:51
Init script to go in the root of a Debian install for booting entirely from the initrd file
#!/bin/sh
# Kenneth Finnegan, 2020
# https://blog.thelifeofkenneth.com/
# Huge thanks to Gandi.net for most of this code
set -x
set -e
# Create the mount points for all of the virtual file systems which don't
# actually map to disks, but are views into the kernel
@PhirePhly
PhirePhly / morningreport.sh
Created January 15, 2012 06:16
A simple example of how to use cron and bash to generate prowl notifications
#!/bin/sh
# Kenneth Finnegan, 2012
# kennethfinnegan.blogspot.com
# Posts growl notifications to iOS device using prowl & curl
#
# To have run by cron at 8:30 daily, add the following to your crontab
# 30 8 * * * /mnt/storage/scripts/morningreport.sh
@PhirePhly
PhirePhly / TwitterMatrixTicker.sh
Created May 31, 2012 02:21
Use a Dot Matrix Printer to print Tweets as they happen
#!/bin/sh
# Kenneth Finnegan, 2012
# kennethfinnegan.blogspot.com
#
# TwitterMatrixTicker
# Given a username and an ascii printer, checks for new mentions and
# prints them one at a time to the printer.
# Expected usage is either spun off into the background >/dev/null or
# on a detachable screen so you can monitor progress.
5 DEF FNA(Z) = 30 * EXP(-Z*Z/100)
100 CLS
105 PRINT:PRINT:PRINT
110 FOR X = -30 TO 30 STEP 1.5
120 L = 0
130 Y1 = 5 * INT(SQR(900-X*X)/5)
140 FOR Y = Y1 TO -Y1 STEP -5
150 Z = INT(25 + FNA(SQR(X*X+Y*Y))-.7*Y)
160 IF Z<=L THEN 190
170 L = Z
@PhirePhly
PhirePhly / dns-catalog-hash.py
Last active September 20, 2019 03:45
Conf files for BIND catalog files example
#!/usr/bin/env python3
import dns.name
import hashlib
import sys
print (hashlib.sha1(dns.name.from_text(sys.argv[1]).to_wire()).hexdigest())
// I2C library using USI hardware support
// Kenneth Finnegan, 2010
// kennethfinnegan.blogspot.com
// Heavily based on Atmel application note AVR310
#include <util/delay.h>
#include <avr/io.h>
#include <inttypes.h>
//#define PARAM_VERIFY