This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MAX_SIZE = 5 | |
let a = [5, 4, 3, 2, 1], | |
b = [], | |
c = []; | |
let abc = { | |
a, | |
b, | |
c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ABMN(AP, PB, AR, RC) { | |
let a1 = AP + PB, | |
a2 = AR + RC, | |
k1 = PB / a1, | |
k2 = RC / a2, | |
d = a1 ** 2 - a2 ** 2; | |
let M = ((k1 * a1) ** 2 - (k2 * a2) ** 2 - (k1 + k2) * d / 2) / (k1 - k2) / 2; | |
let A = (d + 4 * M) / a1 / 4, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add_table_of_contents() { | |
let ul = $('<ul class="table-of-contents">'), | |
lis = ''; | |
$('#documenter-page article.docstring>header').each(function(index, e) { | |
let link = $(this).find('a').attr('href'); | |
let link_html = `<li><a href='${link}'>${$(this).text()}</a></li>` | |
//console.log(link_html) | |
lis += link_html; | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//the list is created from https://github.com/curl/curl/wiki/DNS-over-HTTPS#publicly-available-servers | |
let dohs = ["https://adguard.abd.ong/dns-query", | |
"https://dns.abdullahabas.de/dns-query", | |
"https://abel.waringer-atg.de/dns-query", | |
"https://adl.adfilter.net/dns-query", | |
"https://per.adfilter.net/dns-query", | |
"https://syd.adfilter.net/dns-query", | |
"https://dns.adguard-dns.com/dns-query", | |
"https://family.adguard-dns.com/dns-query", | |
"https://unfiltered.adguard-dns.com/dns-query", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"is_find": true, | |
"red_path": [ | |
0, | |
0, | |
2, | |
0, | |
2, | |
4, | |
6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function r(a, b) { | |
return Math.floor(Math.random() * (b - a)) + a; | |
} | |
function all_equal(arr){ | |
for (let i = 1; i < 6; i++) { | |
if(arr[i] !== arr[0]) return false; | |
} | |
return true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://github.com/Hopsken/openai-api-proxy | |
const upstream = 'https://api.openai.com' | |
export interface Env { | |
OPENAI_API_KEY: string | |
} | |
export default { | |
async fetch( | |
request: Request, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://developer.mozilla.org/en-US/docs/Web/API/Blob | |
//https://stackoverflow.com/questions/18650168/convert-blob-to-base64 | |
function BlobToBase64(blob) { | |
return new Promise((resolve, _) => { | |
const reader = new FileReader(); | |
reader.onloadend = () => resolve(reader.result); | |
reader.readAsDataURL(blob); | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var count = 0; | |
function quicksort(arr) { | |
let length = arr.length, | |
pos = Math.floor(Math.random() * length); //pick a random index position | |
if (length <= 1) return arr; | |
//if (++count > 10) return console.log('error'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function create_edge_TTS({ timeout = 10, auto_reconnect = true } = {}) { | |
const TRUSTED_CLIENT_TOKEN = "6A5AA1D4EAFF4E9FB37E23D68491D6F4"; | |
const VOICES_URL = `https://speech.platform.bing.com/consumer/speech/synthesize/readaloud/voices/list?trustedclienttoken=${TRUSTED_CLIENT_TOKEN}`; | |
const SYNTH_URL = `wss://speech.platform.bing.com/consumer/speech/synthesize/readaloud/edge/v1?TrustedClientToken=${TRUSTED_CLIENT_TOKEN}`; | |
const BINARY_DELIM = "Path:audio\r\n"; | |
const VOICE_LANG_REGEX = /\w{2}-\w{2}/; | |
let _outputFormat = "audio-24khz-48kbitrate-mono-mp3"; | |
let _voiceLocale = 'zh-CN', |
NewerOlder