Skip to content

Instantly share code, notes, and snippets.

@neko-neko-nyan
neko-neko-nyan / rofl_parse.py
Created March 18, 2023 10:52
ROFL file parser (riot game / league of legends replay file)
import base64
import dataclasses
import enum
import gzip
import io
import json
import struct
from pprint import pprint
from Crypto.Cipher import Blowfish
@neko-neko-nyan
neko-neko-nyan / keepass_zc_api.py
Created March 18, 2023 10:51
Simple API client / demo for KeepassXC (simulates browser plugin) in python
import base64
import json
import random
import nacl.public
import win32file
def _check_nonce_length(nonce: str):
return len(base64.decodebytes(nonce.encode())) == nacl.public.Box.NONCE_SIZE
@neko-neko-nyan
neko-neko-nyan / genshin_lyre_play.py
Created May 18, 2022 09:15
MIDI file -> Genshin Impact Lyre
import asyncio
import time
import mido
import pynput.keyboard
KEY_STEPS = [
(0, pynput.keyboard.KeyCode.from_char('z')),
(2, pynput.keyboard.KeyCode.from_char('x')),
(4, pynput.keyboard.KeyCode.from_char('c')),
@neko-neko-nyan
neko-neko-nyan / split_cue.py
Created May 18, 2022 09:14
Splitting audio files using CUE sheet
#!/usr/bin/python
import sys
d = open(sys.argv[1]).read().splitlines()
general = {}
tracks = []
current_file = None
for line in d:
if line.startswith('REM GENRE '):
@neko-neko-nyan
neko-neko-nyan / backgroundd.py
Created May 18, 2022 09:06
Desktop background changing daemon (for linux, using feh)
#!/usr/bin/python3
import json
import math
import os
import random
import subprocess
import sys
import threading
@neko-neko-nyan
neko-neko-nyan / vlc_playlist.py
Last active May 18, 2022 09:12
Writing XSPF playlists with VLC extensions in Python
import typing
class Node:
def write(self, f: 'XMLWriter'):
raise NotImplementedError()
class WithTags:
def __init__(self, **kwargs):
@neko-neko-nyan
neko-neko-nyan / SimpleXMLWriter.py
Created June 12, 2019 13:46
SimpleXMLWriter for Python 3
#
# SimpleXMLWriter
# $Id: SimpleXMLWriter.py 3225 2007-08-27 21:32:08Z fredrik $
#
# a simple XML writer
#
# history:
# 2001-12-28 fl created
# 2002-11-25 fl fixed attribute encoding
# 2002-12-02 fl minor fixes for 1.5.2
@neko-neko-nyan
neko-neko-nyan / find_dogs.py
Created June 12, 2019 13:43
Поиск удаленных и заблокированных аккаунтов (собачек) vk.com серди участников группы или друзей пользователя
#!/usr/bin/env python3
import requests
import sys
import time
TOKEN = None
CLID = "<ClientID приложения>"
@neko-neko-nyan
neko-neko-nyan / anime365.py
Last active June 12, 2019 13:50
API client for smotret-anime-365.ru (anime365 / smotert-anime.ru)
class Api:
def __init__(self, api_url="https://smotret-anime.ru/api/"):
self._api_url = api_url
def translation(self, id=None, **kwargs):
if id is not None:
return self._get(f"translations/{id}", {}, Translation)
return self._get("translations", kwargs, Translation, True)
@neko-neko-nyan
neko-neko-nyan / anime_franchises.py
Created June 12, 2019 13:35
Скрипт поиска не просмотренных аниме в просмотренных франшизах
import json
import os
from time import sleep
import pyshiki
from pprint import pprint
api = pyshiki.Api("<Логин>", "<Пароль>")