Skip to content

Instantly share code, notes, and snippets.

Avatar

Kenneth Finnegan PhirePhly

View GitHub Profile
@PhirePhly
PhirePhly / ISA.txt
Created Mar 26, 2012
Intro to the ISA bus by Mark Sokos
View ISA.txt
THE ISA AND PC/104 BUS
IBM, IBM/XT, IBM PC, and IBM PC AT are registered trademarks of
International Business Machines Corporation.
This file is designed to give a basic overview of the bus found in
most IBM clone computers, often referred to as the XT or AT bus. The
AT version of the bus is upwardly compatible, which means that cards
@PhirePhly
PhirePhly / Makefile
Created Jun 12, 2012
A crazy simple SMTP server, for educational purposes only.
View Makefile
default:
cc ccsmtp.c -o ccsmtpd -lpthread
View mqtt_led_client.py
#!/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):
@PhirePhly
PhirePhly / init
Last active Dec 21, 2020
Init script to go in the root of a Debian install for booting entirely from the initrd file
View init
#!/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 / memdjpeg.c
Created Jul 10, 2012
A bare-bones example of how to use jpeglib to decompress a jpg in memory.
View memdjpeg.c
// memdjpeg - A super simple example of how to decode a jpeg in memory
// Kenneth Finnegan, 2012
// blog.thelifeofkenneth.com
//
// After installing jpeglib, compile with:
// cc memdjpeg.c -ljpeg -o memdjpeg
//
// Run with:
// ./memdjpeg filename.jpg
//
@PhirePhly
PhirePhly / morningreport.sh
Created Jan 15, 2012
A simple example of how to use cron and bash to generate prowl notifications
View morningreport.sh
#!/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
Use a Dot Matrix Printer to print Tweets as they happen
View TwitterMatrixTicker.sh
#!/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.
View prettypatterns.bas
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 Sep 20, 2019
Conf files for BIND catalog files example
View dns-catalog-hash.py
#!/usr/bin/env python3
import dns.name
import hashlib
import sys
print (hashlib.sha1(dns.name.from_text(sys.argv[1]).to_wire()).hexdigest())
View USI_I2C.c
// 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