Skip to content

Instantly share code, notes, and snippets.

@thevar1able
thevar1able / main.py
Created October 5, 2022 03:39
2ch webm scraper
import os
import sqlite3
import requests
from collections import defaultdict
def create_schema():
conn = sqlite3.connect('db.sqlite')
c = conn.cursor()
c.execute('''CREATE TABLE posts
~ ❱ cat .bin/open-iterm2
#!/usr/bin/env bash
# Detects if iTerm2 is running
if ! pgrep -f "iTerm" > /dev/null; then
open -a "/Applications/iTerm.app"
else
# Create a new window
if ! osascript -e 'tell application "iTerm2" to create window with default profile' > /dev/null; then
# Get pids for any app with "iTerm" and kill
@thevar1able
thevar1able / assembler.py
Created January 7, 2023 16:33
nand2tetris: HACK assembler
#!/usr/bin/env python3
import sys
def check_args():
if len(sys.argv) != 2:
print("Usage: python3 assembler.py <file.asm>")
sys.exit(1)
@thevar1able
thevar1able / chip-8.rs
Created January 22, 2023 10:19
CHIP-8 emulator
use std::time::Duration;
use std::{env, io, fs, fmt};
use sdl2::Sdl;
use sdl2::pixels::Color;
use sdl2::render::Canvas;
struct Instruction {
bytes: [u8; 2],
}
1 2 3
4 5 6
7 8 9
0 0 0