Skip to content

Instantly share code, notes, and snippets.

View matthew-e-brown's full-sized avatar

Matthew Brown matthew-e-brown

View GitHub Profile
@matthew-e-brown
matthew-e-brown / CMakeError.log
Last active November 20, 2022 21:03
CMake logs for StackOverflow question about GLFW in Rust. https://stackoverflow.com/q/74511966/10549827
Detecting C compiler ABI info failed to compile with the following output:
Change Dir: C:/Users/Matthew/Dropbox/Coursework/5th Year - 2022-2023/Fall/COIS-4480H Computer Graphics/FinalProject/target/debug/build/glfw-sys-9e8b97620887df2c/out/build/CMakeFiles/CMakeScratch/TryCompile-s3o0tm
Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/amd64/MSBuild.exe cmTC_a734d.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=17.0 /v:m && MSBuild version 17.3.1+2badb37d1 for .NET Framework
CMakeCCompilerABI.c
FileTracker : error FTK1011: could not create the new file tracking log file: C:\Users\Matthew\Dropbox\Coursework\5th Year - 2022-2023\Fall\COIS-4480H Computer Graphics\FinalProject\target\debug\build\glfw-sys-9e8b97620887df2c\out\build\CMakeFiles\CMakeScratch\TryCompile-s3o0tm\cmTC_a734d.dir\Debug\cmTC_a734d.tlog\link-cvtres.read.1.tlog. The system cannot find the path specified. [C:\Users\Matthew\Dropbox\Coursework\5th Year - 2022-2023\F
@matthew-e-brown
matthew-e-brown / Cargo.toml
Last active November 20, 2022 21:03
MWE for StackOverflow question about GLFW in Rust. https://stackoverflow.com/q/74511966/10549827
[package]
name = "please-work"
version = "0.1.0"
edition = "2021"
[dependencies]
gl = "0.14.0"
glfw = "0.47.0"
@matthew-e-brown
matthew-e-brown / queue.ts
Created August 21, 2022 18:01
TypeScript Promise Queue
class QueuePoppedError extends Error {
constructor(message?: string) {
super(message);
}
}
interface QueuedPromise<T> {
runner: () => Promise<T>;
resolver: (value: T | PromiseLike<T>) => void;
rejecter: (reason: any) => void;
@matthew-e-brown
matthew-e-brown / porkbun-dns.js
Created July 31, 2022 21:40
Porkbun Dynamic DNS client written in JavaScript (NodeJS, zero dependencies)
const fs = require('fs/promises');
const path = require('path');
const https = require('https');
const { EOL } = require('os');
const API_URL = `https://api-ipv4.porkbun.com/api/json/v3/`;
const LOG_SIZE = 365 * 3; // keep last 3 years of runs cuz why not
const LOG_FILE = path.resolve(__dirname, `./dns.log`);
const CONFIG_FILE = path.resolve(__dirname, `./.config.json`);
@matthew-e-brown
matthew-e-brown / golomb.rs
Last active September 12, 2024 16:45
Solving the JetBrains Mono C# snippet challenge using Rust.
/// On the JetBrains Mono showcase page, there are some code snippets. In the C# snippet, you'll find a
/// puzzle/challenge...
///
/// - https://www.jetbrains.com/lp/mono/
/// - https://imgur.com/a/GIZfnJ4
///
/// This challenge is interesting because, at first glance, it's easy. The code is already there, all you have to do is
/// run it! The problem comes from the recursive definition of the Golomb Sequence. `g(100_000)` will require calling
/// `g(99_999)`, `g(1479)`, and `g(99_891)`. Then, each of those require their own set of `g(...)` calls. This
/// completely destroys the stack. Herein lies the challenge.
@matthew-e-brown
matthew-e-brown / Win10-SSH-Notes.md
Last active February 1, 2022 22:22
Notes for connecting to desktop through SSH

Windows 10 SSH server setup

Who knew Windows had SSH built in... and to think, I'd just been leaving a WSL window open with sshd running on it...

Stuff that must be done every time

  1. If you did not enable automatic startup of SSH services, enable them:
@matthew-e-brown
matthew-e-brown / algo.rs
Created August 31, 2021 23:10
Two-sum and Four-sum implemented in Rust
// Actual implementations
pub mod proper {
use std::collections::{HashSet, HashMap};
pub fn two_sum(a: &[i32], b: &[i32], n: i32) -> u32 {
let mut count = 0;
let mut complements = HashSet::new();
for x in a.iter() {
complements.insert(n - x);
@matthew-e-brown
matthew-e-brown / rename.sh
Created August 16, 2021 00:47
Renames files with specific extensions to contain only snake-case lowercase titles
#!/usr/bin/bash
# Check if they passed an arugment for which extensions to convert
if [[ $# -eq 0 ]]; then
exts="mkv"
else
exts="$@"
fi
for ext in $exts; do
@matthew-e-brown
matthew-e-brown / agents.js
Last active August 12, 2021 12:43
Scrape Instagram post URLs for all images in that post (including 'album' style posts). Doesn't work on videos; it will just return their thumbnail.
// A user agent is randomly selected from this list; adding more will make it
// harder for the rate limiter to detect you
module.exports = [
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246",
"Mozilla/5.0 (X11; CrOS x86_64 8172.45.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.64 Safari/537.36",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9",
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36",
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1"
];
@matthew-e-brown
matthew-e-brown / flac-exchange.py
Last active December 1, 2024 16:36
A python script to convert FLAC files to iTunes supported formats. Related to my previous Gist with the FFMPEG one-liner.
import sys
import shutil
import subprocess
from os import path, remove
from glob import glob, escape
from argparse import ArgumentParser
prog_desc = """
Recursively convert a directory of FLAC files to either MP3 or AIFF to be
imported into iTunes.\n