This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import math | |
def build_regex(max_size=13): | |
parts = [] | |
for half_size in range(1, math.ceil(max_size / 2) + 1): | |
parts.append("^") | |
parts.append("(.)" * half_size) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
COINS = (200, 100, 50, 20, 10, 5, 2, 1) | |
COIN_INDEXES = {coin: index for index, coin in enumerate(COINS)} | |
class CoinsUsed: | |
def __init__(self, poopyjones=None): | |
self.poopyjones = poopyjones or ([0] * len(COINS)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC := clang | |
CFLAGS := -std=c11 -Ofast -Wall -Wextra -Wshadow | |
SRCDIR := src | |
OBJDIR := obj | |
SRC := $(wildcard $(SRCDIR)/*.c) | |
OBJ := $(SRC:$(SRCDIR)/%.c=$(OBJDIR)/%.o) | |
EXEC := foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _GNU_SOURCE | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define ever (;;) | |
typedef struct { | |
size_t size; | |
char *names; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _GNU_SOURCE | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define ever (;;) | |
typedef struct { | |
size_t size; | |
char *names; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _GNU_SOURCE | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define ever (;;) | |
typedef struct { | |
size_t size; | |
char *names; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import json | |
import random | |
import curio | |
from nettirely import IrcBot, NO_SPLITTING | |
bot = IrcBot(state_path="jeopardy_state.json") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Debug, Clone)] | |
enum Instruction { | |
Unary(String, String), | |
Binary(String, String, String) | |
} | |
#[derive(Debug)] | |
struct CPU { | |
a: isize, | |
b: isize, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import functools | |
import itertools | |
import math | |
def prime_factors(n, sqrt=math.sqrt): | |
limit = sqrt(n) + 1 | |
i = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
UP = (0, -1) | |
DOWN = (0, 1) | |
LEFT = (-1, 0) | |
RIGHT = (1, 0) | |
NEXT_DIRECTION = { | |
RIGHT: UP, |