Skip to content

Instantly share code, notes, and snippets.

@zvodd
zvodd / parsehar.py
Last active May 6, 2024 01:56 — forked from tomatohater/parsehar.py
parsehar.py - Reads a har file from the filesystem, converts to CSV, then dumps to stdout.
"""Reads a har file from the filesystem, converts to CSV, then dumps to
stdout.
"""
import argparse
import json
from urllib.parse import urlparse
def main(harfile_path):
"""Reads a har file from the filesystem, converts to CSV, then dumps to
@zvodd
zvodd / synth_sound_demo.py
Last active March 3, 2024 02:15
pygame, pyaudio, additive "synth" demo with bandpass filter.
import pygame
import pygame_gui
import math
import pyaudio
import struct
SCREEN_X = 800
SCREEN_Y = 600
SCOPE_DIMS = (SCREEN_X//4, SCREEN_Y // 4)
@zvodd
zvodd / mysqldump
Last active November 21, 2023 08:28
Git friendly MySQL Dump
With the default mysqldump format, each record dumped will generate an individual INSERT command in the dump file (i.e., the sql file), each on its own line. This is perfect for source control (e.g., svn, git, etc.) as it makes the diff and delta resolution much finer, and ultimately results in a more efficient source control process. However, for significantly sized tables, executing all those INSERT queries can potentially make restoration from the sql file prohibitively slow.
Using the --extended-insert option fixes the multiple INSERT problem by wrapping all the records into a single INSERT command on a single line in the dumped sql file. However, the source control process becomes very inefficient. The entire table contents is represented on a single line in the sql file, and if a single character changes anywhere in that table, source control will flag the entire line (i.e., the entire table) as the delta between versions. And, for large tables, this negates many of the benefits of using a formal sourc
@zvodd
zvodd / wave_combiner.py
Created February 24, 2023 10:18
pygame + pyaudio "synth": wave generation inspection and filtering
import pygame
import pygame_gui
import math
import pyaudio
import struct
SCREEN_X = 800
SCREEN_Y = 600
SCOPE_DIMS = (SCREEN_X//4, SCREEN_Y // 4)
@zvodd
zvodd / spiralout.py
Created February 23, 2023 07:34
pygame spiral markov chain pixels
import pygame
import numpy as np
SCREEN_X = 256
SCREEN_Y = 256
GRID_SIZE = SCREEN_X //6
CELL_W = SCREEN_X // GRID_SIZE
CELL_H = SCREEN_Y // GRID_SIZE
@zvodd
zvodd / view_wave.py
Created February 21, 2023 14:04
interactive waveform generation and mixing using pygame and pyaudio
import pygame
import pygame_gui
import math
import pyaudio
import struct
SCREEN_X = 800
SCREEN_Y = 600
SCOPE_DIMS = (SCREEN_X//4, SCREEN_Y // 4)
@zvodd
zvodd / BTC_brainwallet.go
Last active January 3, 2023 10:59
Go BTC brainwallet - Generate wallet address and WIF from bitcoin brainwallet password
package main
import (
"crypto/sha256"
"fmt"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcutil/base58"
"golang.org/x/crypto/ripemd160"
)
@zvodd
zvodd / color_palette_from_images.html
Last active November 26, 2022 03:18
color palette js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>whatever</title>
<script>
/*
This is a completly disorganised mess of shoehorning old code into a new proof of concept.
@zvodd
zvodd / howtobasicrust.rs
Created May 9, 2022 16:28
Baby's first rust code. A basic guessing game that was primarily a product of trail and error, as tutorials just aren't as much fun as breaking things.
use rand::Rng;
use std::io;
static HINT_HIGHER: &str = "higher";
static HINT_LOWER: &str = "lower";
fn main() {
println!("Guess the integer between 0 and 9.");
let target: u8 = rand::thread_rng().gen_range(1..10);
@zvodd
zvodd / index.html
Created April 19, 2022 09:27
Client Side JS - Image Upload to Canvas
<!DOCTYPE html>
<html><head>
<style>
.finfo-list{
list-style: none;
display: flex;
flex-wrap: wrap;
align-items: flex-start;
flex-direction: row;
max-height: 80vh;