Skip to content

Instantly share code, notes, and snippets.

@oauo
Last active July 21, 2020 15:41
Show Gist options
  • Save oauo/5cb71fbf04ae2501b721344c2123bdda to your computer and use it in GitHub Desktop.
Save oauo/5cb71fbf04ae2501b721344c2123bdda to your computer and use it in GitHub Desktop.
milk rain generator test #milk
{
"scripts": [],
"styles": []
}
console.clear()
/*let combination = ["a", "h", "l", "t", "ah", "al", "at", "hl", "ht", "lt", "ahl", "aht", "alt", "hlt", "ahlt"]
let sounds = {}
//fetch(`https://rain.today/serve.php?pc=${"hssp10"}&f=${"la"}`).then(x => x.text()).then(console.log)
let fetchSound = (code, options) => {
console.log(`https://rain.today/serve.php?pc=${code}&f=${options}`)
fetch(`https://rain.today/serve.php?pc=${code}&f=${options}`).then(x => x.text()).then(x => {
//let x = _x.split('\n')[2]
if(sounds[code]) {
if(sounds[code][options]) {
if(sounds[code][options].indexOf(x) == -1) {
sounds[code][options] = [...sounds[code][options], x]
}
} else sounds[code][options] = [x]
} else {
let obj = {}
obj[options] = [x]
sounds[code] = obj
}
console.log(sounds)
})
}
fetchSound("hssp10", "la")*/
//root = [208, 161, 208, 162, 208, 144, 208, 154, 208, 144, 208, 157, 32, 208, 156, 208, 158, 208, 155, 208, 158, 208, 154, 208, 144].join(",")
/*const tu3 = a => {
let counter = [0,0,0,0]
for (var e = [], f = 0, g = 0; g < a.length; g++) {
var h = a.charCodeAt(g);
if (128 > h) {
e[f++] = h
} else {
if (2048 > h) {
e[f++] = h >> 6 | 192
} else {
if (55296 == (h & 64512)) {
h = 65536 + ((h & 1023) << 10) + (a.charCodeAt(++g) & 1023)
e[f++] = h >> 18 | 240
e[f++] = h >> 12 & 63 | 128
} else {
e[f++] = h >> 12 | 224
e[f++] = h >> 6 & 63 | 128
e[f++] = h & 63 | 128
}
}
}
}
return [e,counter]
}*/
ru = function (a, b) {
for (var c = 0; c < b.length - 2; c += 3) {
var d = b.charAt(c + 2);
d = "a" <= d ? d.charCodeAt(0) - 87 : Number(d);
d = "+" == b.charAt(c + 1) ? a >>> d : a << d;
a = "+" == b.charAt(c) ? a + d & 4294967295 : a ^ d
}
return a
}
tu = function (a) {
let tkk = [443151, 3928741057]
let b = tkk[0]
for (var e = [], f = 0, g = 0; g < a.length; g++) {
var h = a.charCodeAt(g);
if (128 > h) {
e[f++] = h
} else {
if (2048 > h) {
e[f++] = h >> 6 | 192
} else {
if (55296 == (h & 64512)) {
h = 65536 + ((h & 1023) << 10) + (a.charCodeAt(++g) & 1023)
e[f++] = h >> 18 | 240
e[f++] = h >> 12 & 63 | 128
} else {
e[f++] = h >> 12 | 224
e[f++] = h >> 6 & 63 | 128
e[f++] = h & 63 | 128
}
}
}
}
let x = b;
for (f = 0; f < e.length; f++) {
x += e[f]
x = ru(x, "+-a^+6")
}
x = (ru(x, "+-3^+b+-f") ^ tkk[1])%1E6;
if(0 > x) x = (x & 2147483647) + 2147483648;
return `&tk=${x.toString()}.${x ^ b}`
};
//*
let comp = tu("这里不对劲")
//match2 = comp + ""
console.log(comp, comp == "&tk=640819.984453")/**/
const fun = () => {
//128 > h ? e[f++] = h : (2048 > h ? e[f++] = h >> 6 | 192 : (55296 == (h & 64512) && g + 1 < a.length && 56320 == (a.charCodeAt(g + 1) & 64512) ? (h = 65536 + ((h & 1023) << 10) + (a.charCodeAt(++g) & 1023),e[f++] = h >> 18 | 240,e[f++] = h >> 12 & 63 | 128) : e[f++] = h >> 12 | 224,e[f++] = h >> 6 & 63 | 128),e[f++] = h & 63 | 128)
/*128 > h ? e[f++] = h
: (2048 > h ? e[f++] = h >> 6 | 192
: (55296 == (h & 64512) && g + 1 < a.length && 56320 == (a.charCodeAt(g + 1) & 64512) ? (h = 65536 + ((h & 1023) << 10) + (a.charCodeAt(++g) & 1023), e[f++] = h >> 18 | 240,e[f++] = h >> 12 & 63 | 128)
: e[f++] = h >> 12 | 224,e[f++] = h >> 6 & 63 | 128),
e[f++] = h & 63 | 128)*/
}
//for(let i = 0; i < 1000000; i++) {if((ru(i, "+-3^+b+-f") ^ 2815846078)%1E6 < 0) console.log(i)}
trueContent = !mentions ? "" : await mentions.reduce(async (acc, mention) => {
const id = mention.substring(3, mention.length - 1)
const cached = original.find(x => x.author_id === id) || usercache.find(x => x.id === id)
if (cached) {
acc += trueContent.replace(/<@![0-9]+>/g, `<span class="mention">@${cached.author_nickname}</span>`)
}else {
const body = await fetch('site' + id).then(x => x.json())
body.author_nickame = body.name
usercache.push(body)
console.log(trueContent) // logs <@!id>
trueContent = trueContent.replace(/<@![0-9]+>/g, `<span class="mention">@${body.name}</span>`)
console.log(trueContent) // logs a discord username
}
})
console.log(trueContent) // logs <@!id>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment