Skip to content

Instantly share code, notes, and snippets.

Avatar

Liu Wenyuan Dobby233Liu

View GitHub Profile
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
@Dobby233Liu
Dobby233Liu / gwcb2tna2ts.js
Last active Mar 27, 2021
GWCB2TNA2TS - silly JS code
View gwcb2tna2ts.js
// Get What Can Be Crafted By Thou Numbers And Also Their Sum (GWCB2TNA2TS)
// WTFPL
// but, opitmiz and credit suggested... can you opitmiz it better than my better anyway? (optmiz my better one, not others!) tell me by forking, coding and commenting!
// beautified using https://beautifier.io
function gwcb2tna2ts(im = 4, jm = 4, km = 4)
{ // https://blog.csdn.net/cherrydreamsover/article/details/79750556 port
im++;
jm++;
km++;
var i = 0; // 百位
View bvEncDec.cmb.js
// generated by LWYS-JS-Combiner v0.0.2-private1
// -------------- description (manaully inserted)
// A BVID encoder/decoder written in JavaScript.
// Based on a Python script: https://www.zhihu.com/question/381784377/answer/1099438784
// (semi)written by Dobby233Liu
// WTFPL
// -------------- imports
// js/comp/pythonic.js
var pythonic = {};
pythonic.range = function range(start, stop, step) { // https://stackoverflow.com/a/8273091
@Dobby233Liu
Dobby233Liu / gtimedToSRT.js
Last active Mar 8, 2021
Translates YouTube timed text to SRT. WTFPL. WIP.
View gtimedToSRT.js
// parse-ms
// MIT License, copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
// Modified by Dobby233Liu in slight cooperation with MIT License
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,