Skip to content

Instantly share code, notes, and snippets.

View KokoseiJ's full-sized avatar
😆
あぁ!夏を今もう一回!

Wonjun Jung KokoseiJ

😆
あぁ!夏を今もう一回!
View GitHub Profile
@KokoseiJ
KokoseiJ / startStream.bat
Created November 9, 2024 05:06
Zenith Studio stream script
@echo off
echo Scheduling Youtube Broadcast...
start /MIN /D "C:\Program Files\Google\Chrome\Application\" chrome.exe --profile-directory="Profile 1" "https://script.google.com/macros/s/AKfycbzuJEOnUuFaWvFEmFwpJdX7szbNkPw4XskdBCDhQ3TMO6S7O-I1Er-CNDJvlnd-U7v-/exec/onboot?gameId=pump&isUnlisted=false"
timeout 15
echo Starting OBS Studio...
start /D "C:\Program Files\obs-studio\bin\64bit" obs64.exe --profile "pump" --scene "PIU Studio Stream" --startstreaming --disable-shutdown-check
timeout 15
@KokoseiJ
KokoseiJ / exportgen.py
Created August 8, 2024 09:52
Generate DLL Export redirection, both in pragma format and .def file format, for DLL proxying
import re
import pefile
dllpath = input("DLL dir: ")
dll = pefile.PE(dllpath)
if "drive_c" in dllpath:
dllpath = re.sub(r".*?drive_c", "C:", dllpath).replace("/", "\\")
repath = re.sub(r"\.[dD][lL]{2}", "", dllpath)
@KokoseiJ
KokoseiJ / car_server.py
Last active May 31, 2024 17:28
Cat Tab CDN server implementation
import os
import pam
from hashlib import sha256
from fastapi import FastAPI, Request, File, Depends, HTTPException
from fastapi.staticfiles import StaticFiles
from fastapi.security import HTTPBasic, HTTPBasicCredentials
from pydantic import BaseModel
from typing import Annotated
CAT_FOLDER = os.environ.get("CAT_FOLDER", "./cats")
@KokoseiJ
KokoseiJ / db.py
Created January 18, 2024 07:02
Simple Asynchronous MongoDB ORM on Python
import re
import asyncio
from pymongo import MongoClient
from pymongo.collection import Collection as MongoCollection
from pymongo.results import InsertOneResult, UpdateResult, DeleteResult
from typing import Awaitable, Self
mongo: MongoClient = None
DATABASE_NAME = "kokomemo"
@KokoseiJ
KokoseiJ / dns_update.py
Created September 8, 2023 21:20
Automatically update Cloudflare DNS record for Dynamic IP environment
import re
import json
import requests
IP_REGEX = re.compile(r"\nip=((?:[0-9]{,3}\.){3}[0-9]{,3})\n")
token = ""
zone = ""
CDN_CGI = "https://cloudflare.com/cdn-cgi/trace"
@KokoseiJ
KokoseiJ / snowflake.py
Last active December 20, 2023 19:38
Customizable and portable Snowflake generator
import os
import time
from math import floor
class SnowflakeGenerator:
def __init__(self, mid=None, time_start=1288834974657):
self.time_start = time_start
self.mid = mid if mid else os.getpid()
@KokoseiJ
KokoseiJ / lighttpd.conf
Last active May 25, 2023 17:13
Simple sensord setup with Lighttpd for CGI monitoring utilization
server.modules=("mod_cgi")
server.breakagelog="/var/log/cgi_error.log"
server.document-root="/tmp/www"
server.port=1727
cgi.assign=(".cgi"=>"")
@KokoseiJ
KokoseiJ / usc_crawl.py
Last active May 17, 2023 05:16
dump USC song list from PIU USC site
import json
import requests
from bs4 import BeautifulSoup as bs
URL = "https://www.piugame.com/piu.ucs/ucs.sample/ucs.sample.alltunes.php?page={}"
PAGES = 11
def get_page(pagenum):
@KokoseiJ
KokoseiJ / ameow.md
Last active March 1, 2023 07:22
Stepmania MemoryCard mount analysis

meow

  • MemoryCardManager.cpp/ThreadedMemoryCardWorker::DoHeartbeat

  • MemoryCardDriver::DoOneUpdate

  • MemoryCardDriverThreaded_Linux::GetUSBStorageDevices

  • ThreadedMemoryCardWorker inherits RageWorkerThread, which seems to be timeout-able thread worker

    • It runs heartbeat every 0.1 seconds it seems?
    • It waits 0.1 seconds from when the last heartbeat function has finished
  • Running heartbeat means running DoHeartbeat method

@KokoseiJ
KokoseiJ / usbprofileconfig.py
Created February 21, 2023 19:35
Stepmania USB Profiile Setup Script
#!/bin/env python3
import os
import re
def get_usbdevices(exclude=[]):
usbs = [x for x in os.listdir("/dev/disk/by-path") if "usb" in x]
usbs = sanitize_parts(usbs)
return [x for x in usbs if x not in exclude]