Skip to content

Instantly share code, notes, and snippets.

@NSBum
NSBum / si7021.c
Last active April 27, 2018 09:00
Example of reading from Si7021 with Raspberry Pi
#include <stdio.h>
#include <stdlib.h>
#include <bcm2835.h>
#include <string.h>
/*+---------------------------------------------------------+
| |
| si7021.c - Read Si7021 temperature and humidity |
| over I2C bus using Raspberry Pi |
@NSBum
NSBum / mcp3008.c
Created March 3, 2018 23:39
Reading MCP3008 using C on the Raspberry Pi
// Using C to read the MCP3008 10-bit
// ADC via SPI
#include <stdio.h>
#include <bcm2835.h>
uint8_t start = 0x01;
uint8_t end = 0x00;
uint8_t chan = 0x00;
@NSBum
NSBum / rpi-bcm2835-lib-install.sh
Created March 3, 2018 21:15
Version-agnostic installation of Raspberry Pi BCM2835 library for C
sudo apt-get install html-xml-utils
mkdir -p bcm2835 && (wget -qO - `curl -sL http://www.airspayce.com/mikem/bcm2835 | hxnormalize -x -e | hxselect -s '\n' -c "div.textblock>p:nth-child(4)>a:nth-child(1)"` | tar xz --strip-components=1 -C bcm2835 )
cd bcm2835
./configure
make
sudo make install
@NSBum
NSBum / FadeTrack.scpt
Created January 11, 2018 11:46
Play and fade the current iTunes track
--
-- Created by: Alan Duncan
-- Created on: 2018-01-11
--
-- Copyright (c) 2018 OjisanSeiuchi
-- All Rights Reserved
--
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
@NSBum
NSBum / ru_audio_wiktionary.py
Created November 3, 2017 11:02
Download Russian pronunciation from Wiktionary
#!/usr/bin/python
# encoding=utf8
import re
import requests
import urllib2
import xerox
from os.path import expanduser, normpath, basename, join
import Foundation
import objc
@NSBum
NSBum / Decookify Safari.scpt
Created March 29, 2017 10:49
Remove cookies from Safari
--
-- Created by: Alan Duncan
-- Created on: 2017-03-29
--
-- Copyright (c) 2017 OjisanSeiuchi
-- All Rights Reserved
--
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
@NSBum
NSBum / DT_set_labels.scpt
Created February 24, 2017 10:55
This will set the label of the every global inbox item to the first label
--
-- Created by: Alan Duncan
-- Created on: 2017-02-24
--
-- Copyright (c) 2017 OjisanSeiuchi
-- All Rights Reserved
--
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
--
-- Created by: Alan Duncan
-- Created on: 2017-01-11
--
-- Copyright (c) 2017 OjisanSeiuchi
-- All Rights Reserved
--
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
@NSBum
NSBum / indigo_graph_obasement.py
Last active February 18, 2017 08:29
RRDTool + Indigo for graphing sensor data
import rrdtool
# "Original basement temperature sensor"
temp = indigo.devices[401767099].sensorValue
# "Original basement humidity"
hum = indigo.devices[1437240536].sensorValue
# update our round robin database
entry = 'N:{0}:{1}'.format(temp,hum)
rrdtool.update('/usr/local/share/obasement.rrd','N:{0}:{1}'.format(temp,hum))

macOS 10.12 Sierra Setup

Custom recipe to get macOS 10.12 Sierra running from scratch, setup applications and developer environment. This is very similar (and currently mostly the same) as my 10.11 El Capitan setup recipe and 10.10 Yosemite setup recipe. I am currently tweaking this for 10.12 Sierra and expect to refine this gist over the next few weeks.

I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. I generally reinstall each computer from scratch every 6 months, and I do not perform upgrades between releases.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your o