Skip to content

Instantly share code, notes, and snippets.

View huwcbjones's full-sized avatar

Huw Jones huwcbjones

View GitHub Profile
{"Key Mappings":{"0x9-0x40000":{"Text":"","Action":32},"0xf72b-0x100000":{"Text":"","Action":4},"0xf703-0x280000":{"Action":10,"Text":"f"},"0xf703-0x300000":{"Text":"","Action":0},"0x7f-0x80000":{"Action":11,"Text":"0x1B 0x08"},"0xf728-0x80000":{"Action":10,"Text":"d"},"0xf72d-0x100000":{"Text":"","Action":8},"0xf701-0x300000":{"Text":"","Action":6},"0xf72d-0x20000":{"Text":"","Action":8},"0x19-0x60000":{"Text":"","Action":39},"0xf702-0x280000":{"Action":10,"Text":"b"},"0xf702-0x300000":{"Text":"","Action":2},"0xf700-0x300000":{"Text":"","Action":7},"0xf703-0x320000":{"Text":"","Action":34},"0xf72c-0x100000":{"Text":"","Action":9},"0xf729-0x100000":{"Text":"","Action":5},"0xf72c-0x20000":{"Text":"","Action":9},"0xf702-0x320000":{"Text":"","Action":33}},"Touch Bar Items":{}}
@huwcbjones
huwcbjones / import_unifi_cert.sh
Created May 24, 2022 20:06
Easily import a unifi cert into the keystore
#!/bin/bash
set -e
if [ $# -lt 2 ]; then
echo "$0 KEY_FILE CERT_FILE"
exit 1
fi
key="${1}"
cert="${2}"
@huwcbjones
huwcbjones / 99-onboard-leds.rules
Last active March 19, 2022 16:57
Simple python script to indicate librespot status via the Raspberry Pi PWR/ACT LEDs
SUBSYSTEM=="leds", ACTION=="add", RUN+="/bin/chgrp -R leds /sys%p", RUN+="/bin/chmod -R g=u /sys%p"
SUBSYSTEM=="leds", ACTION=="change", ENV{TRIGGER}!="none", RUN+="/bin/chgrp -R leds /sys%p", RUN+="/bin/chmod -R g=u /sys%p"
@huwcbjones
huwcbjones / club_rankings_utils.py
Last active June 7, 2020 17:30
SportSystems ClubRankings licence to RankingsDB password
"""ClubRankings utilities"""
def get_username(club_code: str, customer_number: int) -> str:
"""
Get the RankingsDB username
:param club_code: 4 letter club code
:param customer_number: customer code
"""
return f"CR_{club_code}_{customer_number}"
FFMPEG Streaming
# Basic Stream Command
.\ffmpeg.exe -stream_loop -1 -re -i '..\..\Darude - Sandstorm.mp4' -tune zerolatency -vcodec copy udp://224.1.1.1:30000
.\ffmpeg.exe -stream_loop -1 -re -i '..\..\Darude - Sandstorm.mp4' -tune zerolatency -filter_complex:v "split=3[out1][out2]" \
-map "[out1]" -filter-f mpegts udp://224.1.1.1:30000
# Play command
from hashlib import md5
from typing import Any, Dict
from zeep import Client
from zeep.transports import Transport
from requests import Session
SS_USER = "sportsys"
SS_PASS = "HC2PjscZxTzenWsxw3573R5npnQvPRnAW5AHpCZ7cfxDgjmPzNTZy2BfmpvQJ2qR"
// ==UserScript==
// @name TalkTalk Webmail Fixer
// @namespace https://gist.github.com/huwcbjones/6afb06aee8734e2f4f3c40794c5e1386
// @version 0.1
// @description Fix webmail view on talktalk
// @author huwcbjones
// @match *://apps.talktalk.co.uk/*
// @grant none
// ==/UserScript==
@huwcbjones
huwcbjones / fusion.cfg
Created August 22, 2019 15:11
Mekanism OpenComputers Fusion Reactor Control Script
-- On/Off Switch Input
in_enable = {address = "", side = 0}
-- Charge Laser Output
out_charge = {address = "", side = 0}
-- Laser Charge Input
in_charge = {address = "", side = 0}
-- Fire Laser Output
@huwcbjones
huwcbjones / fusion.cfg
Last active May 9, 2021 07:54
Nuclearcraft OpenComputers Fusion Reactor Control Script
-- On/Off Switch Input
in_enable = {address = "", side = 4}
-- Preheat Output
out_preheat = {address = "", side = 3}
-- ELectromagnet Energy Cube
elec_energy_cube = {address = ""}
-- Electromagnets Output
@huwcbjones
huwcbjones / vpn_monitor.py
Last active April 23, 2022 13:06
Monitors internet/vpn connection and executes a command when the VPN connection is dropped/internet connection resumed
#!/usr/bin/env python3
import requests
import re
import os
import subprocess
from typing import Optional
# START VARIABLES
dyn_dns_domain = "CHANGE ME" # domain that routes to the remote ip (dyn dns)