Skip to content

Instantly share code, notes, and snippets.

View terror's full-sized avatar

liam terror

View GitHub Profile
import random
random.seed(69420)
print(
''.join(
chr(random.randrange(256) ^ c)
for c in
bytes.fromhex('EA8760D97CD68CB754E490D68D37606E97BBC1BD2B25C605CDC0D532BE')
if random.randrange(2)
@terror
terror / roman.py
Created January 11, 2022 15:51
I <-> 1
import argparse
from unittest import TestCase
A = {
1000: 'M',
900: 'CM',
500: 'D',
400: 'CD',
100: 'C',
90: 'XC',
@terror
terror / rsa.py
Last active December 2, 2021 18:05
Simple RSA implementation in Python
from math import gcd
class ID:
def __init__(self, p = 53, q = 59):
self.__p = p
self.__q = q
@property
def __phi(self) -> int:
return (self.__p - 1) * (self.__q - 1)
@terror
terror / log.txt
Created August 21, 2021 03:34
quwue RUST_LOG=warn,twilight_http=debug
test integration_tests::accept_candidate_with_message ... Aug 20 23:20:05.787 DEBUG twilight_http::client: URL: "https://discord.com/api/v8/gateway/bot"
Aug 20 23:20:05.787 DEBUG twilight_http::ratelimiting: getting bucket for path: GatewayBot
Aug 20 23:20:05.787 DEBUG twilight_http::ratelimiting: making new bucket for path: GatewayBot
Aug 20 23:20:05.788 DEBUG twilight_http::ratelimiting::bucket: starting to get next in queue path=GatewayBot
Aug 20 23:20:05.788 DEBUG background queue task{path=GatewayBot}: twilight_http::ratelimiting::bucket: starting to wait for response headers
Aug 20 23:20:05.906 DEBUG twilight_http::ratelimiting::bucket: updating bucket path=GatewayBot
Aug 20 23:20:05.906 DEBUG twilight_http::ratelimiting::bucket: starting to get next in queue path=GatewayBot
Aug 20 23:20:05.906 DEBUG twilight_http::client: URL: "https://discord.com/api/v8/gateway/bot"
Aug 20 23:20:05.906 DEBUG twilight_http::ratelimiting: getting bucket for path: GatewayBot
Aug 20 23:20:05.906 DEBUG twilight_http::ratel
@terror
terror / fmt-str.py
Last active November 14, 2021 02:50
from string import Template
def main():
x = 'world'
# I.
print(f'hello {x}!')
# II.
print('hello {}!'.format(x))
# The halting problem, will this program
# terminate or run forever?
def main():
mx = j = - 1
for i in range(1, int(input('N: ')) + 1):
# start at every number between [1, N]
steps = 0; curr = i
while curr != 1:
if curr & 1:
package main
import "fmt"
type Stack []string
func (s *Stack) IsEmpty() bool {
return len(*s) == 0
}
import sys, socket, os
from enum import Enum
from cli import cli
class Config:
SERVER_HOST = '0.0.0.0'
SERVER_PORT = 8000
FILES = '../doc'
class Status(Enum):
@terror
terror / test.py
Last active June 20, 2021 22:26
?
import random
class T:
store = []
@staticmethod
def run():
status = lambda name, result: f"[{name}] ... {result}"
for test in T.store:
try:
@terror
terror / ff.py
Created June 9, 2021 15:59
Simple python function frequency counter
import ast, collections, argparse, os
class File:
def __init__(self, path):
self.path = path
@property
def last(self):
return os.path.normpath(os.path.basename(self.path))