Skip to content

Instantly share code, notes, and snippets.

@eu90h
eu90h / ls-usb.fish
Created February 13, 2024 14:37
A fish shell script to list USB devices. (Yes, you can just use `lsusb`)
for f in (ls /sys/bus/usb/devices/*/product)
echo $f && cat $f
end
@eu90h
eu90h / low-ram.diff
Created March 9, 2024 16:35
This patch, intended for Mastodon v4.2 releases, changes some webpack settings so that I can actually build Mastodon on a VPS with low amounts of RAM.
diff --git a/config/webpack/production.js b/config/webpack/production.js
index cec810184..a5807830a 100644
--- a/config/webpack/production.js
+++ b/config/webpack/production.js
@@ -15,8 +15,9 @@ const sharedConfig = require('./shared');
const root = resolve(__dirname, '..', '..');
module.exports = merge(sharedConfig, {
+ parallelism: 1,
mode: 'production',
@eu90h
eu90h / pyo3_bounded_mem.rs
Created March 15, 2024 15:52
A silly PyO3 example to demonstrate memory allocation.
#[pyfunction]
fn process_file(file: &PyAny, callback: &PyAny) {
assert!(callback.is_callable());
let file = file.to_string();
if let Ok(lines) = read_lines(file) {
for line in lines {
Python::with_gil(|py| {
let pool = unsafe { py.new_pool() };
let py = pool.python();
for msg in line.unwrap().replace("}{", "}\n{").split("\n") {