Skip to content

Instantly share code, notes, and snippets.

Avatar

Liu Wenyuan Dobby233Liu

View GitHub Profile
View StrokeSim.py
import random
random.seed()
lettertable = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz "
def rand_word():
while True:
random.seed()
r = ""
len = random.randint(6, 12)
View README.md

Reminder: Use either of the scripts (try batch script first). Remember to remove the fullresolution or whatever name is that thing entry from your config first, to be safe. If you don't want to do anything or is suddenly going to blame SDL1, close the webpage now and forget it; you're just dumb and shouldn't use my scripts.

@Dobby233Liu
Dobby233Liu / thbgm_cmt.py
Created May 23, 2021
dirty py3 to parse musiccmt.txt
View thbgm_cmt.py
with open("musiccmt.txt","r",encoding="shift-jis") as c:
cmt = c.readlines()
writemode=None
linen=0
max=9
total=0
m3u8=open("musicroom.m3u8","w",encoding="utf-8")
m3u8.write("#EXTM3U\n")
str=""
for line in cmt:
View playNote.c
#include <stdlib.h>
#include <x86.h>
#define lastIntroNote 0+26*2
#define lastNote song_LEN // very last entry in song
unsigned int soundIndex = 0; // NTS: use song only for indexing. NOTE: may want to expand
unsigned short soundWait = 0;
// NOTE: this is supposed to run per tick
@Dobby233Liu
Dobby233Liu / clean.py
Last active Feb 12, 2021
Tweet cleaner
View clean.py
# -*- coding: utf-8 -*-
import re
import demoji
if __name__ == "__main__" and demoji.last_downloaded_timestamp() == None:
demoji.download_codes()
URL_REGEX = re.compile("http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+", flags=re.I)
HASHTAG_REGEX = re.compile("((?:^|\uFE0E|\uFE0F|$|(?!(?:[A-Za-z\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0300-\u0374\u0376\u0377\u037a-\u037d\u037f\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u0483-\u052f\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u05d0-\u05ea\u05f0-\u05f2\u0610-\u061a\u0620-\u065f\u066e-\u06d3\u06d5-\u06dc\u06df-\u06e8\u06ea-\u06ef\u06fa-\u06fc\u06ff\u0710-\u074a\u074d-\u07b1\u07ca-\u07f5\u07fa\u0800-\u082d\u0840-\u085b\u08a0-\u08b2\u08e4-\u0963\u0971-\u0983\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bc-\u09c4\u09c7\u09c8\u09cb-\u09ce\u09d7\u09dc\u09dd\u09df-\u09e3\u09f0\u09f1\u0a01-\u0a03\u0a05-\u0a0a\u0
View script.rpy
# Absolutely done
# translated by @Dobby233Liu
# NTS:u是旁白,m是我们的主角,r是我们的对手,c是守护者(就是所谓的 crabbee)
# game/script.rpy:218
translate zh start_de8f8101:
# u "YOU'VE ALREADY ATTAINED THE BEST OUTCOME."
u "你已经得到了最好的结局。"
View function_genString.js
function generateStringByTemplate(arr){
// FIXME: This is a temporary solution. It may cause overflows.
// If you have an excellent way to do this, tell me.
main = ""
for (i of arr) {
z = ""
if (typeof i != "string") { // is i not a string?
if (Array.isArray(i))
z = i // assign a placeholder
else
@Dobby233Liu
Dobby233Liu / README.clearify.md
Created Jun 1, 2020
SCD theme song YT lyrics sorted out
View README.clearify.md

i'm not using gist as pastebin anyway

@Dobby233Liu
Dobby233Liu / deduplicater.lua
Last active Apr 20, 2020
ineffective way to dedup a table in lua
View deduplicater.lua
-- deduplicate value-only table
function dedupTable(origtable)
function tableContainsV(tablee, value)
local fr = false
for i = 1, #tablee do
if tablee[i] == value then
fr = true
break -- i had breakfast today
end
end