Skip to content

Instantly share code, notes, and snippets.

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

Wonjun Jung KokoseiJ

😆
あぁ!夏を今もう一回!
View GitHub Profile
@KokoseiJ
KokoseiJ / skyrim_wrapper.py
Last active February 19, 2022 06:44
Simple Proton wrapper written in Pyrhon
#!/usr/bin/env python3
from tkinter import *
from tkinter import ttk
from tkinter import filedialog
from tkinter import messagebox
import os
import sys
import subprocess
@KokoseiJ
KokoseiJ / setup_ish_vnc.sh
Created February 3, 2022 06:57
Setup xfce VNC environment on ish
apk add openrc \
xorg-server xf86-video-dummy x11vnc \
xfce4 xfce4-terminal \
rc-update add dbus
cat <<EOF > /etc/profile.d/ish.sh
export DISPLAY=:0
export NO_AT_BRIDGE=1
cat /dev/location > /dev/null &
@KokoseiJ
KokoseiJ / archiveorg_checkhash.py
Last active July 8, 2022 02:08
Check md5 hash of batch downloaded archive.org files
import os
import re
import sys
import requests
from hashlib import md5
from xml.etree.ElementTree import fromstring
if len(sys.argv) < 2:
print(f"Usage: {sys.executable} {sys.argv[0]} xml_url")
@KokoseiJ
KokoseiJ / archiveorg_batchdl.py
Last active July 8, 2022 02:08
Batch download files from archive.org collections
import re
import sys
import requests
import threading
import subprocess
from subprocess import DEVNULL
from urllib.parse import unquote, urljoin
def download_file(url, semaphore):
@KokoseiJ
KokoseiJ / hurrhnn_autogen.py
Last active July 8, 2022 02:08
Automatically generate discord object parse code from their docs
import re
import requests
# Do check for: ex) "integer or string"
files = ["Application.md", "Audit_Log.md", "Channel.md", "Emoji.md", "Guild.md", "Guild_Scheduled_Event.md", "Guild_Template.md", "Invite.md", "Stage_Instance.md", "Sticker.md", "User.md", "Voice.md", "Webhook.md"]
known_types = {
# Type: [funcname, casting]
"boolean": ["boolean", None],
@KokoseiJ
KokoseiJ / list.c
Created December 17, 2021 08:03
Simple *char-key linked list implementation
#include "llist.h"
Linkedlist *llist_put(Linkedlist *list, char *key, void *value) {
if (list == NULL) {
list = calloc(1, sizeof(Linkedlist));
*list = (Linkedlist) {key, value, NULL};
return list;
}
if (!strcmp(key, list->key)) {
@KokoseiJ
KokoseiJ / tree.c
Last active December 11, 2021 09:35
Simple Int Binary Tree Implementation For C
#include <stdio.h>
#include <stdlib.h>
struct Node {
int key;
void *data;
struct Node *left, *right, *parent;
};
struct Node *insertNode(struct Node *node, int key, void *data) {
@KokoseiJ
KokoseiJ / Dockerfile
Last active April 26, 2022 05:37
openbox docker with VNC
FROM ubuntu:latest
ENV DISPLAY=:99
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y openbox xvfb x11vnc
CMD rm -rf /tmp/.X99-lock && \
Xvfb $DISPLAY -screen 0 1280x1024x24 & \
openbox & \
@KokoseiJ
KokoseiJ / gist:e4b7f9d5b129fbbfad9092a9a8fd708d
Created August 19, 2021 16:13
Batch convert FLAC to ALAC recursively
find /music -iname "*.flac" -print0 | xargs -P 16 -0 -I @ bash -c 'temp="@"; name="$(echo $temp | sed -E "s/\/.*?\///" | sed "s/.flac//")"; echo $name; ffmpeg -hide_banner -loglevel warning -i "$temp" -c:v copy -c:a alac -ar 44100 "/mnt/d/ALAC/$name.m4a"'
@KokoseiJ
KokoseiJ / toggle_fullscreen.sh
Created August 2, 2021 07:38
Toggle fullscreen on Spotify in Linux
#!/bin/bash
xwininfo -root -tree | grep '("spotify" "Spotify")' | grep -oE '(0x[0-9a-z]{7,8})' | xargs -I % wmctrl -i -r % -b toggle,fullscreen