Skip to content

Instantly share code, notes, and snippets.

View KatsumiKougen's full-sized avatar
🦑
Stay fresh!

Katsumi Kougen KatsumiKougen

🦑
Stay fresh!
View GitHub Profile
#!/usr/bin/env python3
import os, struct, subprocess, random
#import icecream as ic
def GenRndNumber(begin, end, rounding=0):
Number = struct.unpack("Q", os.urandom(8))[0] / 2 ** 64
RangeDist = float(end) - float(begin)
if rounding == 0:
return float(begin) + Number * RangeDist
// Standard C++ stuff
#include <iostream>
#include <array>
#include <cmath>
#include <numbers>
// SDL2 stuff
#include "SDL2/SDL.h"
// Compile: g++ -std=c++20 -Wall -Wextra -pedantic -Ofast SDL2Plasma.cpp -o SDL2Plasma -lSDL2 -fopenmp
// Standard C++ stuff
#include <iostream>
#include <string>
#include <random>
// SDL2 stuff
#include "SDL2/SDL.h"
// Other crazy stuffs
#define SCREEN_WIDTH 320
@KatsumiKougen
KatsumiKougen / julia-set-sdl2.cpp
Last active June 8, 2023 10:50
Julia set in C++, using SDL2 for rendering
/************************************************************
* JULIA SET IN C++ *
* Library used: SDL2 *
* Written by Katsumi -- https://twitter.com/realKatsumi_vn *
************************************************************/
// Standard C++ stuff
#include <iostream>
#include <complex>
#include <vector>
import re
def IMString(string: str) -> str:
out = string
def DiacriticChar(charpair: str) -> str:
match charpair.group()[1]:
case "q":
match charpair.group()[0]:
@KatsumiKougen
KatsumiKougen / yokotaro.py
Created April 22, 2022 10:26
Clipboard manipulation in Python! Clipboard manipulation in Python! Clipboard manipulation in Python! Clipboard manipulation in Python! S**T MICROSOFT!
try:
import clipboard
except ModuleNotFoundError:
print("Dude, type \"pip install clipboard\" and press ENTER!")
else:
from random import choice
string = []
for i in range(10):
@KatsumiKougen
KatsumiKougen / hokage.py
Created April 9, 2022 04:31
Don't ask me
#!/usr/bin/env python3
data = [r"\x124567ef", 435219825313097414482329961, "epacse_edocinu"]
def convert(a, b):
result = ""
for i in range(23, -1, -1):
result += a[b >> 4*i & 15]
return result
@KatsumiKougen
KatsumiKougen / reginditext.py
Created March 31, 2022 14:38
A minimal Discord "regional indicator" text generator
from sys import argv
ri = lambda let: f":regional_indicator_{let}:" if let.isalpha() else " "
print("".join(map(ri, argv[1])))
@KatsumiKougen
KatsumiKougen / han2shin.py
Created October 16, 2021 10:33
A "simplified/traditional Chinese to Japanese simplified character" tool
# NOTE: Requires OpenCC (pip install opencc)
import opencc, sys
if len(sys.argv) <= 2:
print("ERROR: Not enough arguments")
elif sys.argv[1] == "--trad":
converter = opencc.OpenCC("t2jp.json")
print(converter.convert(sys.argv[2]))
elif sys.argv[1] == "--simp":
converter1, converter2 = opencc.OpenCC("s2t.json"), opencc.OpenCC("t2jp.json")
@KatsumiKougen
KatsumiKougen / battle.py
Last active July 12, 2021 11:34
Non-graphical turn-based combat game using Tkinter
import random as r, tkinter as tk, namemaker, sys, time
from tkinter import ttk, messagebox as mb
if len(sys.argv) < 2:
raise OSError("Please enter a name, like this \"python3 battle.py [player_name]\"")
PLAYER_NAME = sys.argv[1]
BOSS_NAME = namemaker.randomName(4, "cv").capitalize()
BOSS_SPECIES = namemaker.randomName(r.randint(2, 5), "cvc").capitalize()
player_data = {