Skip to content

Instantly share code, notes, and snippets.

View KokoseiJ's full-sized avatar
🏠
Y'all, Stay home with your IDE.

Wonjun Jung KokoseiJ

🏠
Y'all, Stay home with your IDE.
View GitHub Profile
@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]
@KokoseiJ
KokoseiJ / itg_setup.sh
Last active May 25, 2023 19:55
CHQ cab setup script
installs=()
configs=()
install_ITGmania () {
if [ -d /mnt/stepmania/itgmania ]; then
echo "Seems like ITGmania is already installed. Do you want to update it to newer version?"
echo "WARNING: This will overwrite the directory with new version!"
read -p "Proceed? (y/n): " -n1 ANSWER
echo
@KokoseiJ
KokoseiJ / pygame_smoothmove_poc.py
Created October 17, 2022 10:32
Moving objects smoothly in pygame with decreasing acceleration rate
import pygame
import time
class SmoothMove:
def __init__(self, surface, orig, dest, duration):
self.surface = surface
self.orig = orig
self.dest = dest
@KokoseiJ
KokoseiJ / bpmconfirm.py
Last active May 23, 2023 20:17
Test BPM
import sys
import time
target_str = sys.argv[-1] if len(sys.argv) > 1 else input("target bpm: ")
target = float(target_str)
spb = 1 / target * 60
input("Waiting for start...")
@KokoseiJ
KokoseiJ / data_spec.md
Created July 3, 2022 03:00
Fileserve rewrite

Data Structure

Root Data

Root data is the data where all the configs get stored.

It contains 2 keys:

key type description
@KokoseiJ
KokoseiJ / meow.cs
Created May 10, 2022 17:30
WmiNetUtilsHelper Decompiled
// System.Management.WmiNetUtilsHelper
using System;
using System.Management;
using System.Runtime.InteropServices;
using System.Security;
internal static class WmiNetUtilsHelper
{
internal delegate int ResetSecurity(IntPtr hToken);
@KokoseiJ
KokoseiJ / b64test.c
Last active November 11, 2022 04:22
Simple (and portable) Base64 implementation in C
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
int countchr(char *str, char chr) {
int i;
for (i=0; *str != '\0'; *str++ == chr ? i++ : 0);