Skip to content

Instantly share code, notes, and snippets.

View thomasantony's full-sized avatar

Thomas Antony thomasantony

View GitHub Profile
@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
@thomasantony
thomasantony / qcl.rb
Last active April 4, 2019 20:44
Installs qcl tool using Homebrew for communicating with QNX OS devices
# Download file and run `brew install qcl.rb`
class Qcl < Formula
desc "A command line tool to transfer files into Qconn-enabled remote device"
homepage "https://github.com/TheHipbot/weather"
url "https://github.com/thomasantony/qcl/archive/master.zip"
sha256 "db762174cd29e827007d97333853e64a8e39210ac4fad23f3083d9912a5ba3ce"
version "1.0.0"
depends_on "perl"
@thomasantony
thomasantony / client.py
Created June 10, 2017 03:30 — forked from marvin/client.py
simple python client/server socket binary stream
import socket
HOST = 'localhost'
PORT = 9876
ADDR = (HOST,PORT)
BUFSIZE = 4096
videofile = "videos/royalty-free_footage_wien_18_640x360.mp4"
bytes = open(videofile).read()
@thomasantony
thomasantony / greyscale.py
Created April 12, 2017 21:22
A Python script for batch converting images to greyscale
"""Batch convert images to greyscale [by Thomas Antony].
Install dependencies:
pip install pillow docopt
Note: If you do not provide an output path, the generated files will be saved
in a folder named "Converted"
Usage:
greyscale.py <in_path> [<out_path>]