Skip to content

Instantly share code, notes, and snippets.

View adamgreig's full-sized avatar

Adam Greig adamgreig

View GitHub Profile
@adamgreig
adamgreig / make_farnell_bom.py
Created July 29, 2014 16:57
Turn a CSV number,qty of Farnell parts into a txt of name,number,url,qty,unit cost,total cost
import requests
from lxml import html
import json
parts = {}
with open("farnell_bom_condensed.txt") as f:
for line in f:
number, qty = line.split(", ")
qty = int(qty)
url = "http://uk.farnell.com/_/_/dp/{}".format(number)

Keybase proof

I hereby claim:

  • I am adamgreig on github.
  • I am adamgreig (https://keybase.io/adamgreig) on keybase.
  • I have a public key whose fingerprint is 872A 023F AE11 1487 1C0A AEB5 80E6 DEA2 6ADA CD09

To claim this, I am signing this object:

/*///------------------------------------------------------
LPTMon - monitor CPU activity and new mail/RSS, display |
this on a series of LEDs connected to parallel |
port one (0x378). If there's a button on input |
one of LPT (pin 10), pressing that clears the |
new email/RSS status. |
To configure your mail/RSS reader, have it |
execute this program with either "newrss" or |
"newemail" as the first argument, to indicate |
a new item, or "norss" / "noemail" to indicate |
@adamgreig
adamgreig / Makefile
Last active August 29, 2015 14:27
BladeRF 10MHz Clock Output
all:
gcc -g -c main.c -Wall -Werror -Wpedantic
gcc -g main.o -lpthread -lm -lbladeRF -Wall -Werror -Wpedantic -o bladerf-10mhz
#!/usr/bin/env python
# Modules from the Python standard library.
import datetime, math, sys, os, logging, calendar, optparse, json, subprocess
# We use Pydap from http://pydap.org/.
import pydap.exceptions, pydap.client, pydap.lib
# Output logger format
log = logging.getLogger('main')
// MODIFIED BY JON SOWMAN
// DELAYMICROSECONDS() DOES NOT DISABLE
// INTERRUPTS ANY MORE, SO DO IT
// MANUALLY
#include <WString.h>
#include <ctype.h>
#include <string.h>
#include <util/crc16.h>
/*
* NewSerialServo
* --------------
* Servo control from the Serial port
*
* ####
* Modified by Adam Greig, Jun 2010, to just move the servo
* to one position or the other on '.' or ',' input.
* ####
*
import cherrypy
from pygooglechart import GoogleOMeterChart
import urllib, urllib2
def getdata():
page = urllib2.urlopen("http://robertharrison.org/listen/view.php?reg=/APEX/")
lastdata = []
lines = page.read().split("\n")
for line in lines:
data = "".join(line.split(" : ")[1:]).split(",")
import serial
import urllib2
import time
ser = serial.Serial("/dev/ttyUSB0", 4800)
lasttime = time.time()
while 1:
line = ser.readline()
if time.time() - lasttime < 10.0:
continue
@adamgreig
adamgreig / fldigi_autotuner.py
Created November 12, 2010 17:22
connect to fldigi via xml-rpc, get the current dial and log frequency, use it to retune the radio to keep the audio frequency at a set point
"""
fldigi autotuner script
Released into the public domain by Adam Greig in 2010
"""
import xmlrpclib
import math
import time
# Desired audio frequency (Hz)