Skip to content

Instantly share code, notes, and snippets.

View Dobby233Liu's full-sized avatar

Liu Wenyuan Dobby233Liu

View GitHub Profile
@Dobby233Liu
Dobby233Liu / MainActivity.java
Created January 30, 2018 15:14
killprocess
package com.mycompany.myapp.kill;
import android.app.*;
import android.os.*;
import android.content.*;
import java.util.*;
public class MainActivity extends Activity
{
@Override
@Dobby233Liu
Dobby233Liu / 42.js
Last active November 3, 2019 09:18
42.js - quickjs bytebeat isolated loader stub, named after the famous 42 melody
/**
* 42.js - quickjs bytebeat isolated loader stub, named after the famous 42 melody
* code: @Dobby233Liu
* WTFPL
* fill up the code(t) section, build using qjsc https://bellard.org/quickjs/ then pipe to anything eg. aplay
* i recommend use node.js more than quickjs, its better, and quickjs is in beta.
* example program using node.js: bytebeat.jsV2.0 https://pastebin.com/xwtRgcfV
* gist: https://gist.github.com/Dobby233Liu/157e2438dcfb7a31209616404b301759
**/
import * as std from 'std'
@Dobby233Liu
Dobby233Liu / px2cfw.js
Last active January 29, 2020 12:02
px2cfw but it's a special ncov api edition... demo: https://ncov-api-mirror.d2l.workers.dev/
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
var BASE_URL = "https://lab.isaaclin.cn/nCoV";
var HOST_URL = "https://github.com/Dobby233Liu";
var HOST_NNM = "Dobby233Liu";
var CREDITS_HTML
= `
由<a href="${HOST_URL}">${HOST_NNM}</a>镜像。此镜像根目录直通原api目录,无需添加/nCoV在目录名前(虽然会自动处理)。原api:<a href="${BASE_URL}">${BASE_URL}</a>。<hr />`
var CREDITS_INSERT_AFTER_FIRST_ENTRY_OF = `body > div > p`;
index = [
{
obj: window.getListByCountryTypeService1,
data: {
creationDate: "createTime",
modifiedDate: "modifyTime",
op: "operator"
}
},
{
@Dobby233Liu
Dobby233Liu / list.adp
Created March 2, 2020 13:29
my adblock plus block rules
fosshub.com##.ad-alt
msfn.org##.ipsMessage.ipsMessage_error.ipsfocus-globalMessage.displayGlobalMessage
imooc.com##.modal-backdrop.in
imooc.com###signin
imooc.com##.rl-modal.in
thememypc.net##.k*-container.k*-2.k*-hide
zhihu.com##.AdblockBanner
jsp.d2l.workers.dev##.jquery-modal.blocker.current
jsp.d2l.workers.dev###oyahpzunevwwuoc-overlay
2heng.xin##.ad-container
@Dobby233Liu
Dobby233Liu / random.js
Last active March 8, 2020 07:28
random strangires for js [might update]
// random strangires based on Math.random [1, inefficine, unstable and wastes time]
Math_random1_part1=()=>Math.sinh(Math.cos(Math.atan(Math.tan(Math.random()*0.124231332135)))*0.252346/Math.LOG2E)%(+(new Date)/Math.LN2%Math.SQRT1_2*Math.E)/(Math.random()*0.043446566)*(Math.random()*0.0011124514%Math.random()+0.0011222)
Math_random1=()=>{
var m = Number(Math_random1_part1()).toString().split("");
var m2 = m.slice(2);
for (let i = m2.length - 1; i > 0; i--) {
const j = Math.floor(Math_random1_part1() * (i + 1));
[m2[i], m2[j]] = [m2[j], m2[i]];
}
var r=parseFloat(m[0]+m[1]+m2.join(""));
@Dobby233Liu
Dobby233Liu / sortNumbers.js
Last active March 24, 2020 01:39
sort numbers to a category for them
function isPrime(num) // https://blog.csdn.net/huang_miao_xin/article/details/51331710
{
if(num == 2 || num == 3) return true;
if(num % 6 != 1 && num % 6 != 5) return false; // 不在6的倍数两侧的一定不是质数
var tmp = Math.sqrt(num);
for(var i = 5; i <= tmp; i += 6) if(num % i == 0 || num % (i + 2) == 0) return false; // 在6的倍数两侧的也可能不是质数
return true; // 排除所有,剩余的是质数
}
function sortNumbers(data = [27, 37, 41, 58, 61, 73, 83, 95, 11, 14, 33, 47, 57, 62, 87, 99]){
var output = {primes: [], composites: [], odds: [], evens: []};
@Dobby233Liu
Dobby233Liu / deduplicater.lua
Last active April 20, 2020 08:23
ineffective way to dedup a table in 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 / README.clearify.md
Created June 1, 2020 00:04
SCD theme song YT lyrics sorted out

i'm not using gist as pastebin anyway

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