Skip to content

Instantly share code, notes, and snippets.

View foxt's full-sized avatar
doing stuff, things & et cetera

foxt

doing stuff, things & et cetera
View GitHub Profile
@foxt
foxt / tpl_easy_smart.lua
Created January 28, 2024 13:58
TP-Link Easy Smart Management Wireshark Dissector
local TPL_KEY = {191,155,227,202,99,162,79,104,49,18,190,164,30,76,189,131,23,52,86,106,207,125,126,169,196,28,172,58,188,132,160,3,36,120,144,168,12,231,116,44,41,97,108,213,42,198,32,148,218,107,247,112,204,14,66,68,91,224,206,235,33,130,203,178,1,134,199,78,249,123,7,145,73,208,209,100,74,115,72,118,8,22,243,147,64,96,5,87,60,113,233,152,31,219,143,174,232,153,245,158,254,70,170,75,77,215,211,59,71,133,214,157,151,6,46,81,94,136,166,210,4,43,241,29,223,176,67,63,186,137,129,40,248,255,55,15,62,183,222,105,236,197,127,54,179,194,229,185,37,90,237,184,25,156,173,26,187,220,2,225,0,240,50,251,212,253,167,17,193,205,177,21,181,246,82,226,38,101,163,182,242,92,20,11,95,13,230,16,121,124,109,195,117,39,98,239,84,56,139,161,47,201,51,135,250,10,19,150,45,111,27,24,142,80,85,83,234,138,216,57,93,65,154,141,122,34,140,128,238,88,89,9,146,171,149,53,102,61,114,69,217,175,103,228,35,180,252,200,192,165,159,221,244,110,119,48}
-- Crypto functions courtesy of
-- https://github.com/koraa/smrtlink_terrible_crypto
func
/* ==UserStyle==
@name Unifi Network - Rotate Topography 90deg
@namespace github.com/openstyles/stylus
@version 1.0.0
@description Rotates the topography 90deg in the Unifi Network dashboard.
@author foxt
==/UserStyle== */
#unifi-network-app-container .topology-svg-container {
transform: rotate(90deg) translate(0%,-100%);
@foxt
foxt / xor_finder.js
Created November 5, 2023 00:48
JS XOR finder
// XORs hexadecimal format with all values 0-255, sorted by the amount of printable characters.
var data = `3d 01 0c 49 18 1c 00 0a 02 49 0b 1b 06 1e 07 49 0f 06 11 49 03 1c 04 19 1a 49 06 1f 0c 1b 49 1d 01 0c 49 05 08 13 10 49 0d 06 0e 47`.split(" ").map((a) => parseInt(a,16))
const xor = (x) => data.map(a => a ^ x).map(a => String.fromCharCode(a)).join("")
const printable = (s) => [...s].filter((a) => ( a.charCodeAt(0) >= 33 && a.charCodeAt(0) <= 126)).join("")
Array(256).fill(1).map((a,i) => i + ": "+ printable(xor(i))).sort((a,b) => b.length - a.length).join("\n")
//
// [...]
// 38: '*o>:&,$o-=8!o)7o%:\"?<o9*=o;'*o#.56o+(a
// 105: Thequickbrownfoxjumpsoverthelazydog.
@foxt
foxt / 01 Screenshot.cs
Last active July 27, 2023 21:58
Xamarin/.NET 7/Microsoft.macOS - Create a screenshot of all windows open.
// Captures a screenshot of all windows open and saves it to pages in a PDF file.
[DllImport("/System/Library/Frameworks/QuartzCore.framework/QuartzCore")]
static extern IntPtr CGWindowListCopyWindowInfo(CGWindowListOption option, uint relativeToWindow);
IntPtr windowsPtr = CGWindowListCopyWindowInfo(CGWindowListOption.All, 0);
var windows = (NSArray)Runtime.GetNSObject(windowsPtr)!;
@foxt
foxt / pvesh.js
Created June 10, 2023 01:34
SSH-like command to connect to a Proxmox node
const ws = require("ws")
var user,host,node;
var connString = process.argv[2]
try {
user = connString.split("@")[0]
host = connString.split("@")[1].split("!")[0]
node = connString.split("@")[1].split("!")[1]
if (!user || !host || !node) throw new Error("Invalid connection string")
@foxt
foxt / pocketchip_usb.py
Created June 26, 2022 20:45
CircuitPython code for converting TCA8418 i2c keyboard matrix to USB
import time
import board
import busio
import usb_hid
import digitalio
from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keycode import Keycode
KEY_MAP = {
1: Keycode.EQUALS,
<!DOCTYPE html><html lang=en><meta charset=UTF-8><meta content="width=device-width,initial-scale=1,user-scalable=no"name=viewport><title>Wordle - A daily word game</title><meta content="Guess the hidden word in 6 tries. A new puzzle is available each day."name=description><meta content=https://www.powerlanguage.co.uk/wordle/ property=og:url><meta content=website property=og:type><meta content="Wordle - A daily word game"property=og:title><meta content="Guess the hidden word in 6 tries. A new puzzle is available each day."property=og:description><meta content=https://www.dailywordle.com/images/wordle_og_1200x630.png property=og:image><meta content=summary_large_image name=twitter:card><meta content=powerlanguage.co.uk property=twitter:domain><meta content=#6aaa64 name=theme-color><link href=manifest.json rel=manifest><link href=images/wordle_logo_32x32.png rel="icon shortcut"sizes=3232><link href=images/wordle_logo_192x192.png rel=apple-touch-icon><style>:root{--green:#6aaa64;--darkendGreen:#538d4e;--yellow:#c
/* Empty CSS file to help theme developers */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
body {
--accent: #CA1115;
--background: #202225;
--background-2: #222;
--background-3: #444;
--text: #fff;
--text-on-accent: #fff;
font-family: "Gotham SSm", "Montserrat", sans-serif;
@foxt
foxt / monaco_theme.json
Created July 3, 2020 01:39
Default Jellyfish Monaco theme.
{
"base": "vs-dark",
"inherit": true,
"colors": {
"editor.foreground": "#BFCAE0",
"editor.background": "#222222",
"editor.selectionBackground": "#3D4350",
"editor.lineHighlightBackground": "#4C576730",
"editorCursor.foreground": "#528BFF",
"editorWhitespace.foreground": "#747369"
/** stolen from https://stackoverflow.com/a/48200842/4156215 **/
/**
* @description Options used when calling CanvasRenderingContext2D.strokeArcGradient() and
* CanvasRenderingContext2D.fillArcGradient().
* @property {Boolean} useDegrees Whether the specified angles should be interpreted as degrees rather than radians.
* (default: false)
* @property {Number} resolutionFactor The number of lines to render per pixel along the arc. A higher number produces
* a cleaner gradient, but has worse performance for large radii. Must be greater
* than 0. (default: 8)