Skip to content

Instantly share code, notes, and snippets.

View daffodilistic's full-sized avatar

T. H. Soh daffodilistic

View GitHub Profile
@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 / 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 / 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 / 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 / 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 / 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).