Skip to content

Instantly share code, notes, and snippets.

View numpde's full-sized avatar

numpde

View GitHub Profile
@numpde
numpde / sim_1hnmr.py
Created March 29, 2025 07:01
How to run MestReNova quietly (on Linux)
def sim_1hnmr(smiles: str):
if not smiles:
return
if not MolFromSmiles(smiles):
return
smiles = CanonSmiles(smiles)
@numpde
numpde / reexport.qs
Created February 12, 2025 15:55
MestReNova script to batch-reexport NMR spectra from .mnova files
/**
* Batch Export Script for LOGS Data Bundle (.zip)
*
* This script processes all `.mnova` files in the specified directory,
* extracts 1D NMR spectra, and exports each file as a LOGS Data Bundle (.zip).
*
* It's partially based on the `LOGSDataBundle.qs` script by MestReNova.
*
* - Uses `saveAsLOGSDataBundle()` to perform the export.
* - Opens each `.mnova` file using `serialization.open()`.
@numpde
numpde / vpn-tray-ubuntu-gnome.sh
Created February 10, 2025 17:33
Sets up a tray icon to connect to the ETHZ VPN
#!/bin/bash
set -euo pipefail
LOGIN_NAME="[email protected]"
GENERAL_PASSWORD=''
OTP_SECRET="..."
HOST="sslvpn.ethz.ch"
OPTS=""
export GDK_BACKEND=x11 # Ensure yad works on Wayland
@numpde
numpde / keyd-setup-asus-rog-falchion.md
Created February 7, 2025 07:14
Installation and remapping process for key remapping using keyd (ASUS ROG FALCHION)

Keyd Setup for ASUS ROG FALCHION Keyboard

This guide installs and configures keyd to remap keys on the ASUS ROG FALCHION keyboard.

  1. Install keyd
    sudo add-apt-repository ppa:keyd-team/ppa
    sudo apt update
    sudo apt install keyd
    sudo systemctl enable --now keyd
@numpde
numpde / disable_falchion_system_control.sh
Last active February 3, 2025 19:00
This script detects the ROG Falchion System Control input device and creates a udev rule to disable it under Wayland. It then reloads udev rules and optionally reboots the system.
#!/bin/bash
set -e # Exit on error
# Ensure script is run as root
if [[ $EUID -ne 0 ]]; then
echo "Error: This script must be run as root (use sudo)." >&2
exit 1
fi
echo "Detecting ROG Falchion System Control device..."
@numpde
numpde / disable_rog_falchion_power_keys.sh
Created February 3, 2025 08:38
Disables the power and sleep keys on the ROG Falchion keyboard via udev hwdb rules.
#!/bin/bash
set -e # Exit immediately on error
# Ensure script is run as root
if [[ $EUID -ne 0 ]]; then
echo "Error: This script must be run as root (use sudo)." >&2
exit 1
fi
echo "Detecting ROG Falchion keyboard..."
@numpde
numpde / disable_rog_falchion_autosuspend.sh
Last active January 31, 2025 17:00
This script disables USB autosuspend for the ASUS ROG FALCHION keyboard persistently by creating a udev rule, reloading the rules, and verifying the change.
#!/bin/bash
set -euo pipefail
# ASUS ROG FALCHION USB Vendor and Product ID
VENDOR_ID="0b05"
PRODUCT_ID="193e"
# Udev rule file path
RULE_FILE="/etc/udev/rules.d/99-rog-falchion.rules"
@numpde
numpde / issues.json
Created November 10, 2024 10:33
WA/TA: Typesense collection for an issue tracker
{
"name": "issues",
"fields": [
{
"name": "thread_id",
"type": "string",
"facet": true,
"optional": false,
"index": true,
"sort": false,
@numpde
numpde / wa-ts_collection_schema.json
Last active October 27, 2024 07:48
WA/TS: Typesense collection schema
{
"name": "wa_conversations",
"fields": [
{
"name": "contacts.wa_id",
"type": "string",
"facet": true,
"optional": false,
"index": true,
"sort": false,
@numpde
numpde / gpt-action-feedback.php
Last active October 25, 2024 11:19
WP: Custom REST API endpoint to report using GPT actions
<?php
/*
Plugin Name: GPT Action Feedback
Description: Allows custom GPTs to report issues or concerns via a REST API endpoint, restricted to users with a specific capability.
Version: 1.0
Author: RA
*/
// Register the custom REST API endpoint only when the plugin is active.
add_action('rest_api_init', 'gpt_register_feedback_endpoint');