Skip to content

Instantly share code, notes, and snippets.

@mgarratt
mgarratt / README.md
Last active March 15, 2025 20:58
AMD GPU On Raspberry Pi

I've been playing with Home Assistant Voice and it's too slow on the hardware I've been using (mostly Raspberry Pis and similar SBCs). I saw Jeff Geerling had gotten external GPUs working on a Pi, so decided to have a go...

Hardware

  • Raspberry Pi 5 8GB
  • PCIe to NVMe board
  • NVMe to Oculink board
  • External PCIe x16 board with Oculink
  • Asus AMD RX480
  • Corsair 550W PSU
@mgarratt
mgarratt / js-is-odd.js
Last active November 22, 2024 11:20
JS is odd
const myMutator = (theObj) => {
const objClone = {...theObj};
objClone.primProp = 2;
objClone.objProp.value = 'mutated!';
};
const myObj = {
primProp: 1,
objProp: { value: 'original' }
};
@mgarratt
mgarratt / end.gcode
Last active January 4, 2021 10:34
Cura Ender-5 Start/End G-code
;Begin Custom End G-code
G91 ;Relative positioning
G1 E-2 F2700 ;Retract a bit
G1 E-2 Z0.2 F2400 ;Retract and raise Z
G1 X5 Y5 F3000 ;Wipe out
G1 Z10 ;Raise Z more
G90 ;Absolute positionning
@mgarratt
mgarratt / conjure.md
Last active April 11, 2025 14:15
Conjure Clojure Cheatsheet

nREPL

Binding Action
<localleader>cd Disconnect from the current nREPL server.
<localleader>cf Connect to a server using the port found in any of the files specified by clojure.nrepl/connection.port-files.
<localleader>sc Clone the current nREPL session.
<localleader>sf Create a fresh session from scratch.
<localleader>sq Close the current session.
<localleader>sQ Close all sessions.
\sl List all sessions.
@mgarratt
mgarratt / update-dns.sh
Last active November 26, 2019 12:16
DDNS in Cloudflare using bash/curl/jq/ipify - Only calls Cloudflare when IP changes and ipify has no rate limit so can be run as often as you like. Requires an ini file in the same format as certbot cloudflare-dns plugin
#!/usr/bin/env bash
ini_file=$1
dns_zone=$2
domain=$3
function load_ini_value {
filename=$1
property=$2
variable=$3
@mgarratt
mgarratt / ghost.conf
Created October 18, 2013 22:13
Upstart script for Ghost Blog
description "Ghost Blog"
author "Mark Garratt"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on shutdown
respawn # restart when job dies
# Start the Process
env DIR=/var/www/
@mgarratt
mgarratt / example.com.conf
Created October 18, 2013 22:01
Ghost Blog
upstream ghost_upstream {
server 127.0.0.1:2368;
keepalive 64;
}
server {
listen 80;
server_name example.com www.example.com;
@mgarratt
mgarratt / randomString.js
Last active December 25, 2015 20:59
A random string generator, useful for passwords and the like. Created in Node.js, but as far as I can tell with work in browsers as well
/**
* Random String
*
* Generates a random string of specified length using charSet.
*
* Optional charSet can either be a RegExp MATCH or String of allowed characters
* if not provided then (nearly) all characters on a UK Keyboard will be used.
*
* @param {Int} len Length of random string
* @param {String|RegExp} charSet The character set to use
@mgarratt
mgarratt / arrow.scss
Last active December 16, 2015 09:28
Sass mixin to add an arrow to one side of a block Based on: http://css-tricks.com/snippets/css/css-triangle/
@mixin arrow($direction, $colour, $size: 5px) {
position: relative;
&:before {
content: '';
display: block;
position: absolute;
width: 0;
height: 0;
@if $direction == up {