Skip to content

Instantly share code, notes, and snippets.

View crclayton's full-sized avatar

Charles Clayton crclayton

View GitHub Profile
@lightrush
lightrush / README.md
Last active August 31, 2025 15:35
Normalize volume level with PulseAudio

Normalize volume level with PulseAudio and simultaneous output

This should work conceptually on any Linux OS with PulseAudio but these particular instructions are for Ubuntu. There are two major reasons for using simultaneous output. The first is self-evident - we can output to say a bluetooth headset and wired headphones at the same time to enable two people to watch a movie with headphones on a single computer. The second reason is a sort of a convenience for setup. We know the simultaneous sink name so the default.pa config would work without modification so long as simultaneous output is enabled. If we were to set this up without that, we'd have to customize the config with our specific device sink name. That's totally doable but personally I always setup simultaneous output. That's why I haven't described the alternative in this gist.

@patrickroberts
patrickroberts / alu32.v
Created December 23, 2017 18:54
Recursive ALU module in Verilog HDL
`timescale 1ns / 1ps
module alu32 (d, Cout, V, a, b, Cin, S);
output[31:0] d;
output Cout, V;
input [31:0] a, b;
input Cin;
input [2:0] S;
wire [31:0] c, g, p;
@justecorruptio
justecorruptio / 2048.py
Last active September 22, 2017 05:17
Tiny 2048
import os,tty;tty.setcbreak(0);M=['']*16
def G(v):
p=['']*4;u=list(filter(str,v));i=3
while u:z=u.pop();p[i]=u and z==u[-1]and 2*u.pop()or z;i-=1
return p
def Y(M,k):i=1;M=zip(*[iter(M)]*4);exec'M=map([list,G][i*k==k*k],zip(*M))[::-1];i+=1;'*4;return sum(M,[])
while 1:
r=id(M)%71+17
while M[r%16]*r:r-=1
if r:M[r%16]=r%7%2*2+2