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
View MainActivity.java
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 / a.js
Last active October 23, 2022 08:58
my messing w/ msedge dev read aloud. ONLY RUN IN edge dev. i give up, so it wont work properly
View a.js
var ARRAY_LENGTH = 16;
var MIN_HEX_LENGTH = 2;
class UUID {
static createUUID() {
const array = new Uint8Array(ARRAY_LENGTH);
window.crypto.getRandomValues(array);
let uuid = '';
@Dobby233Liu
Dobby233Liu / main.js
Last active June 11, 2022 03:57
getIllustUrl. it's useless, maybe
View main.js
/**
* getIllustUrl - DevTools console script to get pixiv illust original image... in it's page
* Written by GitHub@Dobby233Liu
* Public Domain, take the below function is free too.
* note: this script will output to console. output may be:
* url and data (success), boolean and error message, including "GET xxx 4xx/5xx" (api error), or "uncaught error" (something gone wrong)
* offical version always at: https://gist.github.com/Dobby233Liu/1e61dccc9f67156157bcf15387319566
**/
getIllustUrl = (illustID, cb, httpErrorCB) => {
fetch("https://www.pixiv.net/ajax/illust/" + illustID)
@Dobby233Liu
Dobby233Liu / 42.js
Last active November 3, 2019 09:18
42.js - quickjs bytebeat isolated loader stub, named after the famous 42 melody
View 42.js
/**
* 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 / xiaoxiao_tts.py
Last active May 30, 2023 07:05 — forked from xjohjrdy/xiaoxiao_tts.py
superb edit of an old parameterless script
View xiaoxiao_tts.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""Edge Microsoft TTS for Python."""
import sys
from ws4py.client.threadedclient import WebSocketClient
import binascii
import argparse
import json
import requests
import re
@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/
View px2cfw.js
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`;
View a.js
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
View list.adp
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]
View random.js
// 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
View sortNumbers.js
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: []};