Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jjsanderson's full-sized avatar

Jonathan Sanderson jjsanderson

View GitHub Profile
for i in 0..( p_count -1 ) do
in_thread(name: i) do
loop do
chime p_freq[i], dur
sleep p_sleep[i]
end
end
end
@jjsanderson
jjsanderson / TrafficLights-Arduino.ino
Created July 28, 2016 09:02
Traffic Light code for Arduino
#define RED 9
#define AMBER 10
#define GREEN 11
void setup() {
pinMode(RED, OUTPUT);
pinMode(AMBER, OUTPUT);
pinMode(GREEN, OUTPUT);
}
@jjsanderson
jjsanderson / dmesg_output.txt
Created December 7, 2016 22:39
dmesg output for a Raspberry Pi3 which fails to believe it has a wifi interface.
[ 0.000000] Booting Linux on physical CPU 0x0
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 4.4.21-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611) ) #911 SMP Thu Sep 15 14:22:38 BST 2016
[ 0.000000] CPU: ARMv7 Processor [410fd034] revision 4 (ARMv7), cr=10c5383d
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] Machine model: Raspberry Pi 3 Model B Rev 1.2
[ 0.000000] cma: Reserved 8 MiB at 0x36800000
[ 0.000000] Memory policy: Data cache writealloc
@jjsanderson
jjsanderson / find_empties.py
Created February 23, 2017 15:57
Demo Python to put data into randomly-selected, previously-empty element of a source list.
import random
# Initial list of references
source = [0, 1, 3, 4, 0, 5, 7, 0]
print source
# Build list of indices of source where content is zero
emptylist = [i for i, element in enumerate(source) if element == 0]
print emptylist
@jjsanderson
jjsanderson / find_empties2.py
Created February 23, 2017 16:10
Less (?) elegant way of finding empty indices of source list, using itertools
import random
from itertools import compress, count
# Initial list of references
source = [0, 1, 3, 4, 0, 5, 7, 0]
print source
# Build list of indices of source where content is zero
empty = compress(count(), [not x for x in source])
emptylist = list(empty)
@jjsanderson
jjsanderson / heartsdict.py
Created February 23, 2017 16:41
Not sure this is a totally sane way of structuring the data, but … what can I say, I like dictionaries.
import random
hearts = {
"QR001": [5, 38],
"QR002": [15, 60],
"QR004": [0, 00],
"QR005": [3, 92],
"QR093": [0, 92]
}
@jjsanderson
jjsanderson / gist:4436933e79c04c024414aebf9c129abc
Last active April 26, 2019 15:40
VVV provision output (failure) 2019-04-26
$ vagrant up --provision
__ __ __ __
\ V\ V\ V / Varying Vagrant Vagrants
\_/\_/\_/ v2.6.0-git::master
Platform: platform-darwin13.4.0 shell:/bin/bash vagrant-hostsupdater vagrant-vbguest
Vagrant: v2.2.4, VirtualBox: v6.0.6r130049
VVV Path: "/Users/xxxxx/vagrant-local"
Docs: https://varyingvagrantvagrants.org/
@jjsanderson
jjsanderson / network-manager-raspbian-2020-02-05.md
Last active April 20, 2023 17:25
Installing Network Manager on Raspbian 2020-02-05

Installing Network Manager on Raspbian 2020-02-05

NOTE:
This guide was written more than two years ago, which in Pi years means it's now graduated college, or something. Inevitably, it's at least a little out of date, and it may even be entirely misleading. There are several helpful suggestions in the comments (thanks everyone), and most recently a report that what's here plain doesn't work on current (early 2022) Raspbian. Which isn't even called 'Raspbian' any more.
As of Jan 2022 I'm partially back in my office-which-has-access-to-eduroam, and I do have a need to build up a fresh Pi desktop. If and when I get that working I'll update this guide. In the meantime: good luck, and please leave a comment to report success or failure.
(June 2022) Nope, I still haven't actually tried any of this myself. However, I have had to troubleshoot eduroam wifi on my Linux ThinkPad. As of Ubuntu 22.04 it would no longer connect. [This Stack Exchange answer](https://askubuntu.com/questions/27976