Skip to content

Instantly share code, notes, and snippets.

View simmsb's full-sized avatar
💥
ghc: panic! (the 'impossible' happened)

Ben Simms simmsb

💥
ghc: panic! (the 'impossible' happened)
View GitHub Profile
# Skeleton Program code for the AQA COMP1 Summer 2015 examination
# this code should be used in conjunction with the Preliminary Material
# written by the AQA COMP1 Programmer Team
# developed in the Python 3.4 programming environment
import sys
BOARDDIMENSION = 8
@simmsb
simmsb / main.py
Created October 27, 2016 00:12
null created by nitros12 - https://repl.it/EHUO/2
string = 'wewladaeiou'
print([*filter((lambda a: a.lower() in 'aeiou'), string)][-1])
@simmsb
simmsb / program.py
Created November 7, 2016 12:29
aqa completed task 1
# Skeleton Program code for the AQA COMP1 Summer 2015 examination
# this code should be used in conjunction with the Preliminary Material
# written by the AQA COMP1 Programmer Team
# developed in the Python 3.4 programming environment
import sys
BOARDDIMENSION = 8
DEBUG = False # enable debug printing
@simmsb
simmsb / rewriting_aqa_code.py
Created November 8, 2016 22:59
rewriting aqa 2015 code
class pieces(object):
piece_dict = {}
def piece(func):
def predicate():
piece_dict[func.__name__] = func
return predicate
return func
def generate_fen(board :list=list(), turn :str='W'):
def format_rank(rank :list):
return map(lambda x: x[1].__getattribute__({"B":"lower", "W":"upper"}[x[0]])() if str(x).isalpha() else None, rank)
def collate_rank(rank :list):
string = [[k, list(g)] for k,g in groupby(format_rank(rank[1:]))]
return str().join(map(lambda x: str(len(x[1])) if not x[0] else str().join(x[1]), string))
class cpu_commands(object):
def add(self, memory_loc, value):
self.memory[int(memory_loc)] += self.interpret_address(value)
class cpu(cpu_commands):
def __init__(self, initial_size):
self.memory = [0 for i in range(initial_size)]
self.commands = cpu_commands
def run_command(self, string):
package org.raspberrypi.WeatherStation;
import java.io.IOException;
import java.io.InputStream;
import java.net.ProtocolException;
import java.net.URL;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@simmsb
simmsb / bot.py
Last active December 9, 2016 21:36
poopbot
import asyncio
import discord
from discord.ext import commands
class PoopBot(commands.Bot):
def __init__(self, token):
super().__init__(description="poop bot", command_prefix=None)
/*
freak fortress 2 status, written by nitros
*/
#pragma semicolon 1
#include <sourcemod>
#include <freak_fortress_2>
@simmsb
simmsb / LogicGates.py
Created January 9, 2017 16:54
Logic gates
import enum
from itertools import product
class bools(enum.Enum):
true = 1
false = 0
class gate:
rules = {}