Skip to content

Instantly share code, notes, and snippets.

Avatar

Nathan Vander Wilt natevw

View GitHub Profile
@natevw
natevw / prince_svg_js_namespace.html
Last active Jan 21, 2020
Repro for Prince XML issue rendering SVG `<use />` elements from JavaScript/React ("warning: svg: use: @xLink:href required")
View prince_svg_js_namespace.html
<!doctype html>
<html><head>
<meta charset="utf-8">
<title>Testing SVG rendering issue of Prince 13.1</title>
</head><body>
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
>
<defs>
View ham_stat.py
#! /usr/bin/python
import re
import sys
callsign_fmt = sys.argv[1] if len(sys.argv) > 1 else '2x2'
normal_tally = 0
vanity_tally = 0
with open("l_amat/HD.dat", 'r') as file:
@natevw
natevw / multi_id_test.html
Created Jun 20, 2019
Testing whether querySelectorAll finds multiple elements with #non_unique id.
View multi_id_test.html
<!doctype html>
<html><head>
<meta charset="utf-8">
<title>Testing multiple ids</title>
</head><body>
<p id="one">
<span id="not_unique">One</span>
</p>
<p id="two">
<span id="not_unique">Two</span>
@natevw
natevw / gboard_morse.md
Last active Apr 12, 2020
A list of Morse code supported by GBoard Android Keyboard
View gboard_morse.md

Morse code supported by GBoard Android Keyboard

Google's GBoard software keyboard has a Morse code mode.

Here's what characters it currently supports:

  • .-a
  • -...b
  • -.-.c
  • -..d
@natevw
natevw / shell_log.txt
Created Jun 17, 2017
Get CouchDB 2.0.0 working on Amazon Linux
View shell_log.txt
## 2017 June 16 — build CouchDB
# via https://cwiki.apache.org/confluence/display/COUCHDB/Amazon+Linux
# and http://asaf.github.io/blog/2013/07/08/installing-couch-db-on-amazon-ami/
# and https://forums.aws.amazon.com/thread.jspa?threadID=185101 <------ mostly this, without yum java etc…
# also: http://andyfelong.com/2016/12/couchdb-2-0-on-raspberry-pi/
sudo yum --enablerepo=epel update
sudo yum groupinstall "Development Tools"
@natevw
natevw / spi_http_example.js
Created Jun 15, 2016
A quick little script showing someone a general outline of bridging a hardware SPI device to an HTTP api via node.js. It's fairly terse, but I tried to provide a few documentation and project links for further exploration.
View spi_http_example.js
var SPI_DEV = "/dev/spidev0.0", // hardware will be connected to pins matching a certain Linux SPI device
HTTP_PORT = 0, // if you leave 0, a port gets randomly assigned
POLL_INTERVAL = 1e3; // equivalent to 1 second, set to `20` for 20 milliseconds
// this global variable will store the values
var most_recent_value = null;
var spiInstance = require('pi-spi').initialize(SPI_DEV); // this sets up the SPI device for use in node.js
// then we register a timeout that will get called repeatedly at an approximate interval
@natevw
natevw / python_interact_debug_snippet.py
Last active Jun 8, 2016
Helpful Python snippet to drop into code and get an instant "playground" at a breakpoint
View python_interact_debug_snippet.py
# see e.g. http://stackoverflow.com/a/7677387/179583
import code
code.interact(local=dict(globals(), **locals()))
@natevw
natevw / AppDelegate.m
Last active Mar 14, 2016
Hook this up to a coupla text boxes and see NSAnimation only ever do 60fps, picture of sample interface at https://twitter.com/natevw/status/709516893917319168
View AppDelegate.m
@interface MyAnimation : NSAnimation {}
@property NSUInteger frameCount;
@end
@implementation MyAnimation
- (void)startAnimation {
_frameCount = 0;
[super startAnimation];
}
@natevw
natevw / notes.md
Last active May 5, 2019
Using Bus Blaster v4 with STM32F4x SWD
View notes.md

Using Bus Blaster v4 with STM32F4x SWD

For SWD (instead of normal JTAG) you need a different CPLD "buffer logic" image on the Bus Blaster, the KT-Link compatible ones seem like the recommended means.

# with buffer logic at https://github.com/dergraaf/busblaster_v4/blob/master/ktlink/ktlink.svf
# via http://dangerousprototypes.com/forum/viewtopic.php?f=37&t=5954 from https://github.com/mchck/mchck/wiki/Getting-Started#wiki-bus-blaster
curl -O https://github.com/dergraaf/busblaster_v4/raw/master/ktlink/ktlink.svf
openocd -f board/dp_busblaster_v3.cfg -c "adapter_khz 1000; init; svf /Users/natevw/Downloads/ktlink.svf; shutdown"
You can’t perform that action at this time.