Skip to content

Instantly share code, notes, and snippets.

@jonathlt
jonathlt / README.md
Last active December 6, 2022 23:02
Install Postgres 15 with Postgis from source on Raspberry Pi 4

Postgres/Postgis packages on linux are not often the latest versions. Installing from source is not too difficult. This is also an exercise to see if it's possible to run the database on a pi. Compiling may take a while on more lower spec machines.

Build and install postgres

Download source

https://ftp.postgresql.org/pub/source/v15.1/postgresql-15.1.tar.gz

Unzip

@jonathlt
jonathlt / README.md
Last active March 4, 2018 17:35
Get PostgreSQL/Postgis up and running quickly on any Raspberry Pi

Install Hypriot image on the pi as detailed at https://blog.hypriot.com/getting-started-with-docker-on-your-arm-device/

Pull down the postgres image from here https://hub.docker.com/r/tobi312/rpi-postgresql/

This is probably not the best way, but it works! Create a file named start_pg.sh and make it executable:

docker rm postgis docker run --name postgis -d -p 5432:5432 -v /home/pirate/.local/share/postgresql:/var/lib/postgresql/data -e POSTGRES_PASSWORD=mysecretpassword tobi312/rpi-postgresql-postgis:9.6-2.3

Add the following crontab entry:

@jonathlt
jonathlt / gist:764e78b617f69e72ec09e984281e3741
Created January 22, 2018 20:57
Set max routes in openvpn network manager on ubuntu
OpenVPN network manager does not currently have the setting for max-routes in the GUI
The solution to the problem is to rename the openvpn executable and call it from a script with parameters appended
sudo mv /usr/sbin/openvpn /usr/sbin/openvpnm
add the following to a new openvpn file:
#!/bin/sh
/usr/sbin/openvpnm --max-routes 500 "$@"
## code to use tfl countdown api
##
## Get the arrivals for a oarticular stop id
## https://api.tfl.gov.uk/StopPoint/940GZZLUASL/Arrivals?app_id=<app_id>&app_key=<app_key>
## Get the stop ids
##https://api.tfl.gov.uk/Line/131/StopPoints?app_id=&app_key=
@jonathlt
jonathlt / esp8266_ssd1306_display.py
Last active June 3, 2016 22:32
Display text on an SSD1306 display driven by an ESP8266 running Micropython. Must be using the latest port (esp8266-2016-06-03-v1.8.1.bin kickstarter or build from source)
"""
Script to display text on an ssd1306 module
connected to esp8266 running micropython
SSD1306 ESP8266
VCC ---------------3V3
GND ---------------GND
SCL ---------------D1 (Pin4)
SDA ---------------D2 (Pin5)
"""
from machine import I2C, Pin
@jonathlt
jonathlt / copytest.ps1
Created March 6, 2016 12:30
Recursively copy a folder in powershell
$from = 'payload' #directory under current script directory
$to = 'd:\temp'
Get-ChildItem -Path $from | % {
Copy-Item $_.fullname "$to" -Recurse -Force
}
@jonathlt
jonathlt / ZX81Kiosk.md
Last active February 3, 2023 20:22
Run a ZX81 Emulator in "kiosk" mode on a Raspberry Pi

Introduction

I wanted to be able to produce an SD Card distribution for the Raspberry PI which would emulate the ZX81 "out of the box". On startup an appropriate splash screen would be shown and the pi would enter an emulator. Saving would be via a sync with Google drive.

Method

For the most part, I have followed the instructions here:

http://blog.qruizelabs.com/2014/04/29/raspberrypi-kiosk-matchbox-uzbl/

@jonathlt
jonathlt / service.py
Last active August 29, 2015 14:07
Set up a python script to be called on startup of the machine, the script can be started and stopped using sudo testservice start | stop. Script should be copied to /etc/init.d and made executable.
#!/bin/bash
# /etc/init.d/testservice
# Provides: testservice
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This service is used to start a python script