Skip to content

Instantly share code, notes, and snippets.

@randy3k
randy3k / exfat_mount.md
Last active October 3, 2024 06:51
How to mount an exfat and ext4 drive

Mount autmoatically

Use blkid /dev/xxxx to determine UUID of a partition. Then add the following line in /etc/fstab, where UUID should not be quoted.

UUID=XXXX-XXXX  /mnt/media  exfat  defaults,nofail,uid=1000,gid=1000,umask=0022  0  2

Mount manually

@randy3k
randy3k / update-dns-v2.py
Created September 12, 2024 17:46
Cloudflare dns update
import CloudFlare
import requests
myip = requests.get('https://api.ipify.org').content.decode('utf8')
cf = CloudFlare.CloudFlare(token='<TOKEN>')
zones = cf.zones.get(params={'name': '<DOMAIN>'})
if not zones:
raise Exception("zone not found")
@randy3k
randy3k / cloudflare.ini
Created September 4, 2024 19:08
Docker setup for letsencrypt certbot cloudflare
dns_cloudflare_api_token = <CLOUDFLARE-API-TOKEN>
@randy3k
randy3k / homeassistant.conf
Last active September 16, 2024 05:12
Relying homeassistant and octoprint login errors to host rsyslog
# /etc/rsyslog.d/homeassistant.conf on client
# Enabling logging in HA
# logger:
# logs:
# homeassistant.components.http.ban: warning
if ($programname == 'homeassistant' and $msg contains 'Login attempt or request with invalid authentication') then {
$ActionQueueFileName fwdRule1
$ActionQueueMaxDiskSpace 1g
@randy3k
randy3k / netcat.txt
Last active August 25, 2024 04:01
rsyslog netcat example
# 134 = 16 * 8 + 6, i.e. facility = local0 and severity = info
echo "<134>1 - $HOSTNAME $PROGRAMNAME - - hello world" | nc -u -w 0 $DEST 514
@randy3k
randy3k / ender-5-pro-cura-g-code-end
Last active July 2, 2023 17:58
Ender 5 Pro Cura 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
G1 X0 Y0 ;Present print
M106 S0 ;Turn-off fan
M104 S0 ;Turn-off hotend
M140 S0 ;Turn-off bed
@randy3k
randy3k / systemd-journal-gatewayd.md
Last active April 15, 2023 06:55
Fix systemd-journal-gatewayd bug in Home Assistant
sudo rm -rf /run/systemd-journal-gatewayd.sock
sudo touch /run/systemd-journal-gatewayd.sock
sudo reboot
vim /lib/systemd/system/systemd-journal-gatewayd.socket
[Socket]
@randy3k
randy3k / mdns-docker.md
Last active November 13, 2022 06:14
Enable mdns in docker container
@randy3k
randy3k / gpg-ssh-setup.md
Created November 5, 2022 05:26 — forked from mcattarinussi/gpg-ssh-setup.md
A setup guide to use a personal gpg key for ssh authentication

GPG - SSH setup

Generating the master key

Here we create the master key. We want only Certify capability: we use the master key only to create the subkeys, Sign - Encrypt - Authenticate capabilities will be assigned to the subkeys.

Run the following command to start the master key generation process. Select the set your own capabilities creation process (type 8)

  ▶ gpg --full-generate-key --expert

gpg (GnuPG) 2.2.9; Copyright (C) 2018 Free Software Foundation, Inc.

@randy3k
randy3k / sony.txt
Created November 5, 2022 05:01
a list of sony tv supported key
list of available commands: PowerOff, Input, GGuide, EPG, Favorites, Display, Home, Options, Return, Up, Down, Right, Left, Confirm, Red, Green, Yellow, Blue, Num1, Num2, Num3, Num4, Num5, Num6, Num7, Num8, Num9, Num0, Num11, Num12, VolumeUp, VolumeDown, Mute, ChannelUp, ChannelDown, SubTitle, ClosedCaption, Enter, DOT, Analog, Teletext, Exit, Analog2, *AD, Digital, Analog?, BS, CS, BSCS, Ddata, PicOff, Tv_Radio, Theater, SEN, InternetWidgets, InternetVideo, Netflix, SceneSelect, Mode3D, iManual, Audio, Wide, Jump, PAP, MyEPG, ProgramDescription, WriteChapter, TrackID, TenKey, AppliCast, acTVila, DeleteVideo, PhotoFrame, TvPause, KeyPad, Media, SyncMenu, Forward, Play, Rewind, Prev, Stop, Next, Rec, Pause, Eject, FlashPlus, FlashMinus, TopMenu, PopUpMenu, RakurakuStart, OneTouchTimeRec, OneTouchView, OneTouchRec, OneTouchStop, DUX, FootballMode, Social