Skip to content

Instantly share code, notes, and snippets.

@DanielJoyce
DanielJoyce / 1A User set up
Last active May 9, 2020 18:48
Octopi Setup on 64bit arm Ubuntu 20.04 on RPI 4
For now, we can use the ubuntu use, but for improved security, later we will create a dedicated octoprint user
usermod -G dialout -a ubuntu
# add a gpio group
# Out of the box, ubuntu doesn't have one, and /dev/gpiomem is set accessible to only root.root
groupadd -g gpio
usermod -G gpio -a ubuntu
@DanielJoyce
DanielJoyce / gist:aeecc46530feba907e20f17f59bfb78a
Last active April 23, 2020 04:30
Null Ignoring Weighted Avg ("Wacky") operator in pure postgres

Schema (PostgreSQL v12)

        CREATE TABLE test (ts timestamp, value1 float8, value2 float8);
        insert into test values
        ('2017-01-01', 1, 1),
        ('2017-01-02', 1, null),
        ('2017-01-03', 1, 1),
        ('2017-01-04', NULL, 100),
        ('2017-01-05', 1, 1),
@DanielJoyce
DanielJoyce / results.md
Last active April 17, 2020 22:52
gap filling in off-the-shelf postgres

Schema (PostgreSQL v12)

CREATE TABLE test (ts timestamp, email varchar, title varchar);
insert into test values
('2017-01-01', 'me@me.com', 'Old title'),
('2017-01-02', 'me@me.com', null),
('2017-01-03', 'me@me.com', 'New Title'),
('2017-01-04', 'me@me.com', null),
('2017-01-05', 'me@me.com', null),

('2017-01-06', 'me@me.com', 'Newer Title'),

@DanielJoyce
DanielJoyce / 70-uaccess.rules
Last active February 24, 2020 05:57
Setup XP-pen access so you can remap keys with evdevremapkeys
# /lib/udev/rules.d/70-uaccess.rules
# Add this line before LABEL="uaccess_end"
# XP-Pen 13
SUBSYSTEMS=="usb", ATTRS{idVendor}=="28bd", ATTRS{idProduct}=="000b", TAG+="uaccess"
# Restart udev
# sudo udevadm control --reload-rules && sudo udevadm trigger
@DanielJoyce
DanielJoyce / generic_impls.rust
Created January 11, 2019 05:33
Okay, so this is cool....
pub struct Foo {
x: usize
}
pub struct Baz {}
pub trait Derp<Foo> {
fn foo_it(&self);
@DanielJoyce
DanielJoyce / 10-xp-pen-keyboard.hwdb
Last active January 2, 2019 04:56
Libwacom setup for XP 13.3 Artist
# In /etc/udev/hwdb.d
evdev:input:b0003v28BDp000B*
KEYBOARD_KEY_d0045=332