This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <unistd.h> | |
#include <math.h> | |
#include "libbladeRF.h" | |
int main(int argc, char* argv[]) { | |
struct bladerf *dev; | |
int status; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import hmac | |
import struct | |
import base64 | |
import hashlib | |
def code(secret): | |
key = base64.b32decode(secret) | |
message = struct.pack(">Q", int(time.time()) / 30) | |
h = hmac.new(key, message, hashlib.sha1).digest() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* lmt2.c - Calculate R and N register values for an LMT2 PLL. | |
* Written in 2013 by Adam Greig <adam@adamgreig.com> | |
* | |
* To the extent possible under law, the author has dedicated all copyright | |
* and related and neighboring rights to this software to the public domain | |
* worldwide. This software is distributed without any warranty. | |
* | |
* For details, see http://creativecommons.org/publicdomain/zero/1.0/ | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "pebble_os.h" | |
#include "pebble_app.h" | |
#include "pebble_fonts.h" | |
#define MY_UUID { 0x8B, 0xA6, 0x5F, 0x1D, 0xB1, 0x08, 0x44, 0xAA, 0xA8, 0x17, 0x17, 0xFE, 0xCD, 0x3A, 0x89, 0xDA } | |
PBL_APP_INFO(MY_UUID, | |
"IIB Countdown", "Adam Greig", | |
1, 0, /* App version */ | |
DEFAULT_MENU_ICON, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set fish_greeting | |
function activate | |
set -x VIRTUAL_ENV_DISABLE_PROMPT '1' | |
. venv/bin/activate.fish | |
end | |
function fish_prompt | |
if [ $USER = "root" ] | |
set_color -b RED WHITE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set fish_greeting | |
function activate | |
set -x VIRTUAL_ENV_DISABLE_PROMPT '1' | |
. venv/bin/activate.fish | |
end | |
function fish_prompt | |
if [ $USER = "root" ] | |
set_color -b RED WHITE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Copyright 2012 Adam Greig <adam@adamgreig.com> | |
# | |
# email_away_highlights.py | |
# Email highlights received while away. | |
SCRIPT_NAME = "email_away_highlights" | |
SCRIPT_AUTHOR = "Adam Greig <adam@adamgreig.com>" | |
SCRIPT_VERSION = "1.0" | |
SCRIPT_LICENSE = "GPL3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import couchdbkit | |
import datetime | |
import hashlib | |
import base64 | |
import time | |
s = couchdbkit.Server("http://localhost:5984") | |
NUMDOCS = 1000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import couchdbkit | |
db = couchdbkit.Server("http://habitat.habhub.org/")['habitat'] | |
#db = couchdbkit.Server("http://localhost:5984/")['test_fieldnames'] | |
mapping = { | |
'Sats': ('satellites', None), | |
'temp_int': ('temperature_internal', None), | |
'main_battery_volts': ('battery', None), | |
'pressure_hpa': ('pressure', 100.0), |