Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
import argparse
import subprocess
import requests
def get_webhook_url():
with open("/etc/chime/webhook") as f:
return f.read().strip()
@gerard
gerard / godaddy-dns.py
Created July 14, 2023 16:18
DNS record update via godaddy API
#!/usr/bin/env python3
import os
import json
import argparse
import subprocess
import requests
def get_secret(sname):
#!/usr/bin/env python
from fractions import *
import copy
import texttable
import pprint
HORIZONTAL = 1
VERTICAL = 2
BN = 1000000
#!/usr/bin/env python
import random
import matplotlib.pyplot as mpl_plot
import mpl_toolkits.mplot3d as mpl_plot3d
def simple_rand():
rand_next = 1
while True:
rand_next = rand_next * 1234567 + 12345
@gerard
gerard / AVLTree.hs
Created May 10, 2009 20:46
AVL Tree in Haskell
module AVLTree where
data BT = L | N Int BT BT deriving (Show, Eq)
-- Nice, small and useful functions
empty = L
-- You could say, depth L == Nothing depth (N v L L) == Just 0, but works for
-- me better this way:
depth L = 0
depth (N _ t u) = (max (depth t) (depth u)) + 1
@gerard
gerard / bfuck.c
Created May 10, 2009 20:45
Brainfuck interpreter in C
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#define BFSIZE 30000
void fuck(int f) {
char c;