Skip to content

Instantly share code, notes, and snippets.

View thomasantony's full-sized avatar

Thomas Antony thomasantony

View GitHub Profile
@thomasantony
thomasantony / splitter.py
Created February 16, 2025 01:22
Split text into sections
def split_tracks(input_file, output_pattern="Track{}.md"):
current_track = None
current_content = []
with open(input_file, 'r', encoding='utf-8') as f:
lines = f.readlines()
for line in lines:
line = line.strip()
@thomasantony
thomasantony / gist:b27c86e62d27f6517b5f5bf9017103ca
Created November 27, 2024 04:03
TamperMonkey Script to Remove and Block X users
// ==UserScript==
// @name Twitter Remove and Block
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Adds a "Remove and Block" button to Twitter followers page
// @author Your username
// @match https://twitter.com/*/followers
// @match https://x.com/*/followers
// @grant none
// ==/UserScript==
@thomasantony
thomasantony / null_space.rs
Created November 24, 2024 20:23
Null space using nalgebra
use nalgebra::{DMatrix, DVector};
fn compute_nullspace_qr(a: &DMatrix<f64>, tolerance: f64) -> DMatrix<f64> {
// Get dimensions
let (m, n) = a.shape();
// Compute QR decomposition with column pivoting
let qr = a.clone().qr();
let r = qr.r();
@thomasantony
thomasantony / bc.py
Created June 21, 2023 02:07
ODEs and Boundary conditions generated for the "constrained brachistochrone" problem using https://github.com/thomasantony/beluga/
import numpy as np
from math import *
def bc_func_left(_ya, _p, _aux):
# Declare all auxiliary variables
g = _aux['const']['g']
_constraint1 = _aux['const']['_constraint1']
eps_constraint1 = _aux['const']['eps_constraint1']
[] = _p
# Generalize to multipoint later
@thomasantony
thomasantony / chatgpt_parser_md.py
Last active January 11, 2024 13:21
Convert saved HTML transcripts from ChatGPT to Markdown
# Save the transcripts using the "Save Page WE" Chrome Extension
# This script was generated by ChatGPT
import sys
from bs4 import BeautifulSoup
# Check if a file was provided as a command line argument
if len(sys.argv) < 2:
print("Please provide an HTML file as a command line argument.")
sys.exit(1)
@thomasantony
thomasantony / macos_setup.sh
Last active March 18, 2022 20:35
A script for setting up a windows cross-compiler toolchain on WSL or Linux that works for ffi crates built using `cc`. Made specifically for building orbiter addons in Rust on Linux.
#!/bin/sh
# Build and install llvm from source
wget https://github.com/llvm/llvm-project/archive/refs/heads/main.zip
unzip llvm-project-main.zip
rm llvm-project-main.zip
cd llvm-project-main
# cmake -S llvm -B build -DLLVM_ENABLE_PROJECTS="clang;lld"
cmake -S llvm -B build -DLLVM_DEFAULT_TARGET_TRIPLE="i686-pc-windows-msvc" -DLLVM_ENABLE_PROJECTS="clang;lld"
@thomasantony
thomasantony / box_ptr.h
Created January 10, 2022 22:30
An implementation of unique_ptr to wrap a rust Box type from cxx.rs
#include "rust/cxx.h"
#include <memory>
using std::shared_ptr;
using std::unique_ptr;
using rust::Box;
template <typename T> struct BoxDeleter {
void operator()(T* ptr){
Box<T> val = Box<T>::from_raw(ptr);
@thomasantony
thomasantony / main.min.css (deploy)
Created August 9, 2020 22:29
Comparison of generated CSS files
/*!normalize.css v8.0.0 | MIT License | github.com/necolas/normalize.css*/html{line-height:1.15;-webkit-text-size-adjust:100%}html,body,main,div,span,a,li,ul,hr,h1,h2,h3,h4{padding:0;margin:0}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:0;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button}button::-moz-focus-inner,[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::
@thomasantony
thomasantony / mqtt_client.rs
Created January 17, 2020 16:24
Rust rumqtt client example
use rumqtt::{MqttClient, MqttOptions, QoS, Notification};
use std::{thread, time::Duration};
use std::collections::HashMap;
use std::sync::Arc;
fn foo(payload: Arc<Vec<u8>>)
{
println!("Got foo message: {:?}", payload);
}
fn bar(payload: Arc<Vec<u8>>)
@thomasantony
thomasantony / settings.json
Created December 1, 2019 19:39
My VSCode settings
{
"atomKeymap.promptV3Features": true,
"editor.multiCursorModifier": "ctrlCmd",
"editor.formatOnPaste": true,
"[markdown]": {
},
"workbench.startupEditor": "newUntitledFile",
"files.exclude": {
"node_modules": true