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
# Example of faking a server for mgeme testing | |
# (Mgeme is a project of mine, but this code example may be useful to somebody else anyway) | |
import asyncio | |
import websockets | |
import sys | |
import json | |
host = sys.argv[1] | |
port = sys.argv[2] | |
secret = sys.argv[3] |
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
#Get roster reports from NHL's official API | |
#https://gitlab.com/dword4/nhlapi/-/tree/master/ | |
#https://www.kevinsidwar.com/iot/2017/7/1/the-undocumented-nhl-stats-api | |
import requests | |
class Person: #I don't have any reason for making this a class besides dot notation | |
def __init__(self, n, name): | |
self.n = n | |
self.name = name |
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
#https://www.virtualdub.org/docs/vdscript.txt | |
#Open vdub>File>Job Control>File>Load job list badda bing badda boom | |
import os | |
import re | |
frame_group_pattern = re.compile('([a-z]\d)_(\d+)\.tga') | |
jf_out = input("This file should be saved to...>") | |
in_dir = input("Frames In Dir >") | |
out_dir = input("AVI Out Dir >") |
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
""" | |
A simple Discord bot to display a user queue with add up / unadd buttons via reactions - a basic task most bots will need. | |
This bot uses a single Cog for the purposes of using member attributes to keep track of data in a typical OOP w/ async fashion. | |
""" | |
import discord | |
from discord.ext import commands | |
TOKEN = open("token.txt", "r").read() | |
prefix = "!" |
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 requests | |
import cmd | |
import os | |
import magic | |
import json | |
import sys | |
URL = "http://127.0.0.1:8080/" | |
def mimetype(path): |
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
#There have been 538 electors since 1964 | |
#I am operating on the critical - but possibly wrong - assumption that the number of electors per state is static | |
electors = { | |
"California": 55, | |
"Nevada": 6, | |
"Oregon": 7, | |
"Washington": 12, | |
"Idaho": 4, | |
"Utah": 6, |
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
//This class is nonexhaustive, as I didn't want to spend an hour creating a bunch of useless subclasses. | |
class Log( | |
val version: Int, | |
val success: Boolean, | |
val info: Info, | |
val players: HashMap<String, pInfo> | |
) { | |
data class pInfo( | |
val team: String, | |
val class_stats: List<class_stats>, |
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
//An expanding mean function created as my own implementation of pandas' .expanding(window).mean() | |
//Only thing missing is the window size option. | |
fun expandingMean (data: List<Float>): MutableList<Float> { | |
var result = mutableListOf<Float>() | |
var i = 0 | |
for (value in data.listIterator()) { | |
result.add(data.slice(0..i).average().toFloat()) | |
i += 1 | |
} |
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 datetime import datetime | |
seasons_ESEA = { | |
3: (datetime(2009, 5, 4), datetime(2009, 8, 2)), | |
4: (datetime(2009, 8, 9), datetime(2009, 11, 15)), | |
5: (datetime(2009, 11, 30), datetime(2010, 3, 6)), | |
6: (datetime(2010, 4, 12), datetime(2010, 7, 13)), | |
7: (datetime(2010, 7, 23), datetime(2010, 11, 30)), | |
8: (datetime(2011, 1, 6), datetime(2011, 4, 14)), | |
9: (datetime(2011, 6, 13), datetime(2011, 9, 25)), |
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 json | |
import os | |
from collections import Counter | |
import sys | |
non_bmp_map = dict.fromkeys(range(0x10000, sys.maxunicode + 1), 0xfffd) | |
IDs = {} | |
for file in os.listdir(".logs"): | |
with open(os.path.join('.logs', file), "r") as f: |
NewerOlder