Skip to content

Instantly share code, notes, and snippets.

@technillogue
technillogue / accounting.sql
Created October 19, 2021 03:39 — forked from 001101/accounting.sql
Basic double-entry bookkeeping system, for PostgreSQL.
CREATE TABLE accounts(
id serial PRIMARY KEY,
name VARCHAR(256) NOT NULL
);
CREATE TABLE entries(
id serial PRIMARY KEY,
description VARCHAR(1024) NOT NULL,
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0),
-- Every entry is a credit to one account...
import math
from moviepy.editor import concatenate, ImageClip
import os
import platform
import subprocess
import random
import torch
# pip install pytorch-pretrained-biggan
from pytorch_pretrained_biggan import (BigGAN, truncated_noise_sample, convert_to_images)
import numpy as np
#mount a Gutenberg CD
mount -t iso9660 PG2003-08.ISO iso -o loop
# flatten the hierarchy of a Gutenberg CD
cp $(find iso -name "*.txt") lt/corpus
# strip the corpus
for i in $(ls corpus); do < corpus/$i ./strip.py > words/$i; done
# count some words
for i in $(ls words); do < words/$i ./wordcount.py > wc/$i; done
#!/usr/bin/python
import timing
import zipfile
import os
import shlex
import subprocess
import glob
import shutil
import MySQLdb
import sys
@technillogue
technillogue / calc.py
Last active February 22, 2022 18:20 — forked from anonymous/gist:5882172
A simple python calculator using lambda expressions
operations = {
"+": lambda x, y: x + y,
"-": lambda x, y: x - y,
"/": lambda x, y: x / y,
"*": lambda x, y: x * y
}
def calculate(expr):
numxChars = ""
operation = None