Skip to content

Instantly share code, notes, and snippets.

View cls's full-sized avatar

Connor Lane Smith cls

View GitHub Profile
@cls
cls / codons.c
Last active May 9, 2020 15:02
Counting DNA codons. Mostly an exploration of multidimensional array pointers. (No input checking.)
#include <stdio.h>
#define CHAR_TO_BASE(C) (((C) >> 1) & 3)
enum base {
A = CHAR_TO_BASE('A'),
C = CHAR_TO_BASE('C'),
G = CHAR_TO_BASE('G'),
T = CHAR_TO_BASE('T'),
};
@cls
cls / mircrev.c
Last active February 28, 2021 00:18
Reversal of mIRC rich text (ASCII only)
#include <ctype.h>
#define BIT(X) (1 << (X))
#define CTRL(X) ((X) - '@')
enum { None = -1 };
enum {
Bold = CTRL('B'),
Colour = CTRL('C'),
@cls
cls / dissre.py
Last active March 19, 2024 07:22
Python regular expression bytecode disassembler
import re
import sre_compile
import sre_parse
from sre_constants import *
opcodes = dict((v,k) for (k,v) in OPCODES.items())
atcodes = dict((v,k) for (k,v) in ATCODES.items())
chcodes = dict((v,k) for (k,v) in CHCODES.items())
def print_dis(s, indent):