View gist:9d5f7de8fea56c36d3181e515216e808
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
//var f = "uncomment me to change colours"; | |
var yellow = new Uint16Array([0x0000,0xFFC0],0,1); // black, yellow | |
var white = new Uint16Array([0x0000,0xffff],0,1); // black, white | |
var red = new Uint16Array([0x0000,0xf800],0,1); // black, red | |
var buf = Graphics.createArrayBuffer(240,160,1, {msb:true}); | |
function flip(x,y,palette) { | |
g.drawImage({width:240,height:40,bpp:1,buffer:buf.buffer, palette:palette},x,y); |
View img2nn.pl
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
#!/usr/bin/perl | |
# neural net to represent an image by mapping (x,y) => (r,g,b) | |
# James Stanley 2021 | |
# inspired by https://news.ycombinator.com/item?id=28448626 | |
use strict; | |
use warnings; | |
use AI::FANN qw(:all); |
View cat-laser.ino
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
/* Cat Laser */ | |
#include <Servo.h> | |
// pin configuration | |
const int xservopin = 2; | |
const int yservopin = 3; | |
const int speedpin = A0; | |
const int dwellpin = A1; | |
const int xrangepin = A2; |
View gzipboi.py
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
#!/usr/bin/env python3 | |
import gzip, os, sys | |
infile = open("fresh-food-16.json", "r") | |
b = bytes(infile.read(),"utf8") | |
n = 0 |
View tyre-squeal.gd
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
# This is the tyre squeal model from this clip: https://youtu.be/Likwgc5s_T0 | |
# You need an "AudioStreamPlayer3D" at the position of each wheel, and then run | |
# this function from _process_physics, with each wheel node passed | |
func tyre_squeal(tyre): | |
# increase squeal amplitude with road speed | |
var speed_factor = 1 | |
if (get_speed_kph() < 100): | |
speed_factor = 0.5 + 0.5 * (get_speed_kph()/100) |
View jesboard.ino
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 <Keyboard.h> | |
#define NKEYS 3 | |
unsigned long mintime = 20; // ms (debounce time) | |
int keypin[NKEYS] = {2,3,4}; | |
char letter[NKEYS] = {'j', 'e', 's'}; | |
int isdown[NKEYS]; | |
unsigned long lastchange[NKEYS]; |
View diff
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
diff --git a/Vagrantfile b/Vagrantfile | |
index 317fd6d..54ecde1 100644 | |
--- a/Vagrantfile | |
+++ b/Vagrantfile | |
@@ -45,12 +45,11 @@ Vagrant.configure("2") do |config| | |
-p 5601:5601 \ | |
--network audit" | |
- d.run "docker.elastic.co/beats/filebeat:7.7.0", | |
+ d.run "docker.elastic.co/beats/filebeat:7.7.0 -e -strict.perms=false", |
View jesblog
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
#!/usr/bin/perl | |
# jes's crappy blog generator | |
use strict; | |
use warnings; | |
use DateTime; | |
use DateTime::Format::Strptime; | |
use File::Copy; | |
use JSON qw(decode_json); |
View rc2014-vga.ino
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
// 19x10 VGA serial display | |
// James Stanley <james@incoherency.co.uk> | |
// Note that this needs a modified version of VGAX.h that only uses 1bpp instead of 2bpp else there isn't enough RAM | |
#include <VGAX.h> | |
//font generated from BITFONZI - by Sandro Maffiodo | |
#define FNT_NANOFONT_HEIGHT 6 | |
#define FNT_NANOFONT_SYMBOLS_COUNT 95 | |
//data size=570 bytes |
View jesblog
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
#!/usr/bin/perl | |
# jes's crappy blog generator | |
use strict; | |
use warnings; | |
use DateTime; | |
use DateTime::Format::Strptime; | |
use File::Copy; | |
use JSON qw(decode_json); |
NewerOlder