Skip to content

Instantly share code, notes, and snippets.

View fastjack's full-sized avatar

Martin Maciaszek fastjack

View GitHub Profile
@fastjack
fastjack / .gitconfig
Created August 26, 2024 19:21
Useful git aliases
[alias]
discard = reset HEAD --hard
rmuntracked = clean -df
unstage = reset HEAD --
uncommit = reset --soft HEAD^
@fastjack
fastjack / application:__init__.py
Created May 22, 2024 17:19
Init of flask app (replace : with / in filename)
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
database = SQLAlchemy()
class Application:
def __init__(self, port: int = 5000, debug: bool = True):
self.port: int = port
@fastjack
fastjack / README.md
Created January 29, 2024 18:53
Install Tailscale on Unify Dream Router (not really working)

I tried setting up Tailscale on my UDR. I found https://gist.github.com/lg/6f80593bd55ca9c9cf886da169a972c3 was a good starting point with some adjustments. Unlike the EdgeRouter the UDR is apparently an arm64 device so I downloaded static binaries for arm64 and extracted them to a temporary directory. I copied the files to their proper locations like this:

cp tailscale /usr/bin/tailscale
cp tailscaled /usr/sbin/tailscaled
cp systemd/tailscaled.defaults /etc/default/tailscaled
cp systemd/tailscaled.service /lib/systemd/system/tailscaled.service
mkdir -p /var/lib/tailscale
touch /var/lib/tailscale/tailscaled.state
chmod 0400 /var/lib/tailscale/tailscaled.state
@fastjack
fastjack / Readme.md
Last active December 22, 2023 00:01
NeXT on Raspberry

Start with Raspberry OS 64 bit with graphical interface Install dependencies:

sudo apt-get install build-essential
sudo apt-get install libsdl2-dev libudev-dev libts-dev libgl1-mesa-dev libglu1-mesa-dev libasound2-dev libpulse-dev libopenal-dev libaudiofile-dev libdbus-1-dev libdirectfb-dev cmake subversion zlib1g-dev libpng-dev

Checkout code:

svn checkout https://svn.code.sf.net/p/previous/code/trunk previous-code
@fastjack
fastjack / sensors.yaml
Created December 13, 2023 08:46
Home Assistant sensors from InfluxDB
sensor:
- platform: influxdb
host: a0d7b954-influxdb
username: reader
password: !secret influx_reader_password
queries:
- name: outside_temp
unit_of_measurement: "°C"
value_template: "{{ value | round(1) }}"
where: '"node" = ''esp8266-15564468'''
@fastjack
fastjack / day01-part1.bas
Created December 3, 2023 13:13
Advent of Code 2023, Day 1, Part 2
10 OPEN 1, 8, 3, "INPUT.TXT,S,R"
20 S = 0
30 INPUT#1, A$
40 GOSUB 100
50 S = S + C
60 IF ST = 0 GOTO 30
70 CLOSE 1
80 PRINT S
90 END
100 L = LEN(A$)
@fastjack
fastjack / day01-part2.bas
Last active December 3, 2023 13:12
Advent of Code 2023, Day 1, Part 2
100 DIM S$(9), D$(9)
110 S$(1)="ONE":S$(2)="TWO":S$(3)="THREE":S$(4)="FOUR":S$(5)="FIVE":S$(6)="SIX":S$(7)="SEVEN":S$(8)="EIGHT":S$(9)="NINE"
120 D$(1)="O1E":D$(2)="T2O":D$(3)="T333E":D$(4)="F44R":D$(5)="F55E":D$(6)="S6X":D$(7)="S777N":D$(8)="E888T":D$(9)="N99E"
130 OPEN 1, 8, 3, "INPUT.TXT,S,R"
140 S = 0
150 INPUT#1, A$
160 GOSUB 230
170 S = S + C
180 IF ST = 0 GOTO 150
190 CLOSE 1
@fastjack
fastjack / buttons.lib
Created March 27, 2023 17:17
Code examples from Section 9 of Digital Research's Programmer’s Utilies Guide
; macro library for pedestrian pushbuttons
;
cwinp equ 00h ;input port for crosswalk
;
push? macro iftrue
;; "push?" jumps to label "iftrue" when any one
;; of the crosswalk switches is depressed. The
;; value has been latched, and reading the port
;; clears the latched values
in cwinp ;;read the crosswalk switches
"""This is a driver for storing metrics into specific databases"""
class DriverBase:
"""Abstract database driver"""
_registry = {}
_driver_options = {}
drivername = None
@classmethod
labels:
- 'traefik.enable=true'
- 'traefik.docker.network=traefik-proxy'
- 'traefik.http.routers.bitwarden-ui.rule=Host(`bitwarden.foodomain.com`)'
- 'traefik.http.routers.bitwarden-ui.entrypoints=websecure'
- 'traefik.http.routers.bitwarden-ui.tls=true'
- 'traefik.http.routers.bitwarden-ui.service=bitwarden-ui'
- 'traefik.http.services.bitwarden-ui.loadbalancer.server.port=80'
- 'traefik.http.routers.bitwarden-websocket=Host(`bitwarden.foodomain.com`) && Path(`/notifications/hub`)'
- 'traefik.http.routers.bitwarden-websocket.entrypoints=websecure'