Skip to content

Instantly share code, notes, and snippets.

@justinturpin
justinturpin / scrape.py
Created June 10, 2024 15:48
humble bundle scraper
#!/usr/bin/env python3
import httpx
from bs4 import BeautifulSoup
import json
import click
from pathlib import Path
@justinturpin
justinturpin / build.zig
Created May 23, 2024 17:15
Piper static build
// Build Piper-TTS into a static binary
const std = @import("std");
const ArrayListu8 = std.ArrayList([]const u8);
/// Non-recursively iterate over a directory and add its *.c paths to paths.
/// This isn't used anywhere, but I'm putting it here in case anyone finds it useful.
/// If you want it to be recursive, you basically change dir.iterate() to dir.walk().
pub fn glob_sources(allocator: std.mem.Allocator, base: []const u8, ext: []const u8, paths: *ArrayListu8) !void {
var dir = try std.fs.cwd().openDir(base, .{ .iterate = true });
@justinturpin
justinturpin / asyncsqlite.py
Created May 8, 2023 20:56
Async Sqlite Wrapper
"""
An Async Sqlite wrapper.
TODO: allow multiple simultaneous readers
TODO: writers should block readers
"""
import asyncio
import sqlite3
import threading

Keybase proof

I hereby claim:

  • I am justinturpin on github.
  • I am justinturpin (https://keybase.io/justinturpin) on keybase.
  • I have a public key ASCxtwSMwv9m0JUaxK934yvxJLrTTxIp3EJUeRAVHK0CZwo

To claim this, I am signing this object:

@justinturpin
justinturpin / index.html
Created December 28, 2020 20:52
Working Vue and Rollup JS
...
<script type="module" src="/static/bundle.js"></script>
...
@justinturpin
justinturpin / config.py
Last active September 10, 2015 00:01
Python Config Class
from ConfigParser import ConfigParser
class Config:
def __init__(self, paths):
self._config_parser = ConfigParser()
loaded_configs = self._config_parser.read(paths)
def __getattr__(self, k):
return self._config_parser.get("default", k)