Skip to content

Instantly share code, notes, and snippets.

View daffodilistic's full-sized avatar

T. H. Soh daffodilistic

View GitHub Profile
@daffodilistic
daffodilistic / RX6H_README.md
Last active August 2, 2025 05:39
Using the RX6H Retro Game Console (And Others) as a Mobile IoT Gateway/Lightweight Compute Device

Steps to achieve a working state for SSH

  1. Backup stock SD card, do not format it yet
  2. Download the UnofficialOS image for R36 clones and follow these instructions. Other OSes might work, but take note that if your device comes with ArkOS as stock, you will need to generate a compatible DTB file which works with non-BSP OSes (see Links/Resources for BSP vs non-BSP Linux builds)
  3. Check that you can boot into Linux and have working D-pad and button controls (you should load into EmuStation after about 1 to 2 minutes of booting up). Depending on your requirements, you might want to ensure the analog sticks are working as well.
  4. Ensure you have a working USB OTG dongle/cable. Plug it into your device (specifically for RX6H, it is the HOST port and not the DC/OTG port).
@daffodilistic
daffodilistic / edmw-qol.js
Last active March 13, 2025 14:10
EDMW QOL
// ==UserScript==
// @name EDMW QOL
// @namespace forums.hardwarezone.com.sg
// @include https://forums.hardwarezone.com.sg/*
// @require https://code.jquery.com/jquery-3.6.0.min.js
// @version 1
// @grant GM.addStyle
// ==/UserScript==
/* global $ */
if ($('body').hasClass('gotoverlay')) {
@daffodilistic
daffodilistic / lazy_random_color.js
Created November 25, 2022 03:06
Lazy JavaScript Random Color
function getRandomColor(excludeHex) {
let rgb = [ 255, 255, 255 ];
return `${excludeHex ? '' : '#'}${rgb.map(x => Math.floor(Math.random() * 255 + 1).toString(16)).join("")}`;
}
@daffodilistic
daffodilistic / luminus_auto_sort_filename.user.js
Last active February 19, 2022 03:39
Auto-sort by filename on page load in LumiNUS
// ==UserScript==
// @name LumiNUSAutoSort
// @description Sorts files alphabetically by default when you view the "Files" section of a module in LumiNUS
// @author Soh Thiam Hing
// @license OSL-3.0
// @version 1.0
// @match https://luminus.nus.edu.sg/*
// @namespace com.daffodilistic.tampermonkey
// @require https://cdn.jsdelivr.net/gh/CoeJoder/waitForKeyElements.js@6b9ca81bf32899b4274086aa9d48c3ce5648e0b6/waitForKeyElements.js
// ==/UserScript==
@daffodilistic
daffodilistic / standup.js
Created October 18, 2021 00:21
Google App Script to automatically post a Slack message for Daily Standups
function doGet(e) {
const slackWebhookUrl = "https://hooks.slack.com/services/";
const meetingUrl = "https://meet.google.com/";
let today = new Date();
today.setHours(today.getHours() + 8);
// Logger.log("Date and time is " + today.toISOString());
if (today.getDay() >= 1 && today.getDay() <= 5) {
const formattedDate = Utilities.formatDate(today, "GMT+8", "E d MMM yyyy");
const text = `*Standup - ${formattedDate} 10.10 AM Video Meeting*\n${meetingUrl}\n`;
@daffodilistic
daffodilistic / shrink.md
Last active September 22, 2021 03:52
Shrink an LVM Volume Online on Synology NAS Devices

Scenario

Synology DS418 on v6.2.4-25556 does not allow shrinking of volumes via the GUI. Thus, this must be done via an SSH terminal. This gist is written as generically as possible so that it works for the general use-case of shrinking volumes formatted with the BTRFS filesystem, and then expanding another one. For this scenario, it's a volume that's being used for Time Machine.

Instructions

  1. SSH into the Synology NAS and switch to root account with sudo su.
  2. Run btrfs filesystem show to list the volumes:
root@SynologyNAS:~# btrfs filesystem show
@daffodilistic
daffodilistic / usbgadget_razer.sh
Created August 23, 2021 04:39 — forked from tothi/usbgadget_razer.sh
Razer USB gadget on Android for Local Privilege Escalation on Windows
# MINIMAL USB gadget setup using CONFIGFS for simulating Razer Gaming HID
# devices for triggering the vulnerable Windows Driver installer
# credits for the Windows Driver install vuln: @j0nh4t
#
# https://twitter.com/j0nh4t/status/1429049506021138437
# https://twitter.com/an0n_r0/status/1429263450748895236
#
# the script was developed & tested on Android LineageOS 18.1
@daffodilistic
daffodilistic / odoo.service
Created May 26, 2021 05:58
Systemd unit to start a docker container with proper logging
[Unit]
Description=Odoo Docker Container Service
Requires=docker.service network.target
After=docker.service network.target
[Service]
Type=exec
User=root
Group=google-sudoers
WorkingDirectory=/var/docker
@daffodilistic
daffodilistic / backup_sql.py
Last active June 23, 2021 07:37
Automatically dump SQL data to Google Cloud Storage
#!/usr/bin/env python
import subprocess
import os
import pipes
import argparse
from zipfile import ZipFile
from google.cloud import storage
from datetime import datetime
parser = argparse.ArgumentParser()
@daffodilistic
daffodilistic / keepalive.py
Last active April 28, 2021 13:13
Keeps a GCP instance alive. Useful for preemptible instances
import os
from googleapiclient import discovery
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "./service-account-key.json"
HOSTNAME = "example.com"
GCP_PROJECT = 'project_name'
GCP_INSTANCE_ZONE = 'instance_zone'
GCP_INSTANCE_NAME = 'instance_name'