Skip to content

Instantly share code, notes, and snippets.

View khazhyk's full-sized avatar
🍡
🍡

khazhyk khazhyk

🍡
🍡
View GitHub Profile
MTEyNjg0MjMzMzAyMDExOTA0.YEa2mg.56u4WtPK5dC3LWbQ7N88pNxSfKO
import re
import datetime
from bs4 import BeautifulSoup
from enum import Enum
# if psn or xbl, region is "global"
class Platform(Enum):
pc = "pc"
async def test(bot):
"""logs_from iterator tests."""
# standard default before handling
lis = []
async for msg in bot.logs_from(discord.Object(id="182580524743655424"), limit=200):
lis.append(msg)
for x, i in enumerate(reversed(range(200))):
assert(str(i) in lis[x].content)
# I made this and I thought it was neat.
class aobject(object):
"""Inheriting this class allows you to define an async __init__.
So you can create objects by doing something like `await MyClass(params)`
Similar to http://stackoverflow.com/a/33140788/3213282, although I came to this independantly, and don't use decorators.
"""
async def __new__(cls, *a, **kw):

Keybase proof

I hereby claim:

  • I am khazhyk on github.
  • I am khazhyk (https://keybase.io/khazhyk) on keybase.
  • I have a public key ASA5dAOnNSMLViXjuVEnEZo3bl5251piMgdZkiIOyWSOYAo

To claim this, I am signing this object:

<!DOCTYPE html>
<html>
<head>
<title>khaz.io</title>
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<style type="text/css">
html {
height:100%;
background:#161616;
-moz-box-shadow: inset 0 0 40px #000;
@khazhyk
khazhyk / stats.py
Last active September 27, 2015 04:18
#! /usr/bin/env python3
from urllib import request as urllib
import re
import os
import struct
import datetime
import json
import sys
import dateutil