Skip to content

Instantly share code, notes, and snippets.

View kaecy's full-sized avatar
🌄
I'm awake.

Eris kaecy

🌄
I'm awake.
  • Freelancer
  • England
View GitHub Profile
@kaecy
kaecy / birc.py
Last active December 12, 2021 13:03
IRC library in python in development.
from socket import socket
from threading import Thread
from message import MessageParser, MessageBuffer
class Socket(socket):
def __init__(self, address, port):
socket.__init__(self)
self.connect((address, port))
class IRCMessageLoop(Thread):
@kaecy
kaecy / getMentionEntities.py
Last active December 22, 2021 19:47
Py/Telegram extension.
from telethon.tl.types import MessageEntityMention
def getMentionEntities(message):
mentions = []
for entity in message.entities:
if type(entity) is MessageEntityMention:
offset = entity.offset
length = entity.length
mentions.append(message.message[offset:offset + length])
return mentions
@kaecy
kaecy / Metadata.py
Last active December 22, 2021 19:41
Transform data objects into python traversable objects and go as deep as you want.
# Added bool detection.
# Added serialization.
class Metadata:
def __new__(type_, data):
if type(data) == dict:
return super().__new__(type_)
if type(data) is list:
items = []
import os
import sys
import shutil
# Sub types.
SubTypes = ['.srt']
# Video types.
VideoTypes = ['.mp4', '.avi', '.mkv']
from telethon import TelegramClient, events
lt = 1532541774
rtBaseUrl = "https://t.me/rtnews/"
# Automatic Message Forwarder For RT
async def messageHandlerForRT(event):
# Ignore single messages, part of a group.
if type(event) == events.newmessage.NewMessage.Event and event.message.grouped_id:
return
@kaecy
kaecy / fctrl.c
Created October 29, 2021 00:09
lame foobar2000 remote controller.
#include "stdio.h"
#include "windows.h"
void sendContrlKey(int vKeyCode) {
INPUT inputs[4];
ZeroMemory(inputs, sizeof(inputs));
inputs[0].type = INPUT_KEYBOARD;
inputs[0].ki.wVk = VK_CONTROL;
@kaecy
kaecy / ytdata.py
Last active October 30, 2021 08:30
yt channel feed stuff.
import requests
import json
import yaml
basePath = "https://www.googleapis.com/youtube/v3"
class YTChannelFeed:
def __init__(self, channelId):
self.config = yaml.safe_load(open("feeds/config.yaml"))
self.channelId = channelId
@kaecy
kaecy / eycf.py
Last active October 27, 2021 08:04
yt channel feed stuff.
import urllib.request
import urllib.error
import urllib.parse
import os, bs4, json, yaml, feedparser
def updateChannel(channelUrl):
res = urllib.request.urlopen(channelUrl)
soup = bs4.BeautifulSoup(res.read(), features="html.parser")
for child in soup.html.body.children:
-
hash: 6881d96b7604bd046e3b19e9b50ef48b
char: who knows
-
hash: 3bcb9bef89eef4dbd26935711a592020
char: Alice Zuberg
anime: Sword Art Online
-
hash: 4a7cbec6f436a8faedbb6b3e3f5a5091
char: Fuyumi Irisu
@kaecy
kaecy / script.py
Last active October 2, 2021 16:41
Makeshift add delay to .SRT files.
subs = SubtitleFile("the grudge.srt")
subs.delay(-1000)
subs.save("new subs.srt")