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
#!/bin/bash | |
# Let's write a webserver in Bash because haha why not | |
# Copyright (c) 2017-2020 TerrorBite <terrorbite@lethargiclion.net> | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
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
from typing import Dict, Any, Type, TypeVar, Optional, Sequence, Union | |
from contextlib import contextmanager | |
T = TypeVar | |
class NamedConstantMeta(type): | |
def __init__(cls, *args, **kwargs): | |
super().__init__(*args, **kwargs) | |
#: This class attribute will be the dict mapping constant names to their constants. |
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
/* | |
Piston Elevator Controller | |
A Space Engineers script by TerrorBite | |
(Not just for elevators! Can be used any time that you want a piston to move to a | |
certain preset length and then turn off.) | |
WARNING: You may experience some lag while the piston is moving (especially after running | |
the game for a long time). This is unavoidable and is a result of the Program Block being | |
run repeatedly and rapidly by a Timer Block in order to monitor the piston. I have taken |
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
import struct | |
import crc32c | |
import errno | |
import gw2util | |
# Headers | |
gw2_header1 = struct.Struct("<B3sIII") | |
gw2_header2 = struct.Struct("<IIQII") | |
# GW1 header |
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
import socket | |
import threading | |
import re | |
import time | |
class ircOutputBuffer: | |
# Delays consecutive messages by at least 1 second. | |
# This prevents the bot spamming the IRC server. | |
def __init__(self, irc): | |
self.waiting = False |
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
import struct, re, argparse | |
# This regex matches lines that look vaguely like assembly code | |
re_prelim = re.compile(r'(?:[A-Z]{3}|[a-z]{3})\s') | |
# This regex is used to parse the data from a line of assembly code | |
re_line = re.compile( | |
r'^(?:\S+\s+)?(?P<instr>[A-Z]{3}|[a-z]{3})\s+(?P<arga>[A-Za-z0-9_\[\]+]+)\s*(?:,\s*(?P<argb>[A-Za-z0-9_\[\]+]+))?' | |
) |
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
# The Hour of the Dead was when men died. And when a man died, they sent him | |
# home by clacks. | |
# | |
# Moist's mouth dropped open. 'Huh?' | |
# | |
# 'That's what they call it,' said Harry. 'Not lit'rally, o' course. But they | |
# send his name from one end of the Trunk to the other, ending up at the tower | |
# nearest his home.' | |
# |
OlderNewer