Skip to content

Instantly share code, notes, and snippets.

View NovaSagittarii's full-sized avatar
🍞
wishing for silence

Тhоmаs LI NovaSagittarii

🍞
wishing for silence
  • Southern California
  • 23:21 (UTC -07:00)
View GitHub Profile
@NovaSagittarii
NovaSagittarii / pixi-spine-animation-transfer.js
Created January 26, 2024 07:34
Experimental code snippets to transfer sprite animations between similar sprites, tested on https://flashmercurymcfly.github.io/Arknights-SD-Viewer/
// helper scripts (mostly just for the SD interactions for testing the animation transfer)
const C = viewer.app.stage.children;
function generateTransposition(target, source){
const transposition = []; // output
const collisions = {};
for(let i = target.length-1; i >= 0; i --) collisions[target[i].name] = i;
for(let i = source.length-1; i >= 0; i --){
const j = collisions[source[i].name];
if(j === undefined) continue;
transposition[i] = j;
function overwrite(k, stats) {
const labels = ["PPS", "APM", "VS", "APP", "VS/APM", "DSPS", "DSPP", "CI", "GE"];
k.innerHTML = labels.map((l, i) => `<span>${meanstdev(stats.map(x=>x[i]).filter(x=>!isNaN(x)))}</span> <div>${l}</div> `).join('<br>')
}
function meanstdev(array) {
const n = array.length
const mean = array.reduce((a, b) => a + b) / n
const stdev = Math.sqrt(array.map(x => Math.pow(x - mean, 2)).reduce((a, b) => a + b) / n)
return mean.toFixed(2) + " \u00b1 " + stdev.toFixed(2);
// https://stackoverflow.com/a/53577159
@NovaSagittarii
NovaSagittarii / codeforces-status-submissions-scraper.js
Last active December 12, 2022 23:09
CodeForces Status submissions scraper (JS)
// Yoink all AC solution from the Status page of codeforces, using JS to interact with the site
// Submissions are output as {problemChar}-{contestantName}-{submissionId}.{language-suffix}
/** HOW TO USE
* 1. Go to status page - https://codeforces.com/group/----/contest/----/status
* 2. Open JS console (three dots in top right -> [More Tools] -> [Developer Tools] -> [Console])
* 3. Paste code snippet into JS console
* 4. [ALLOW] multiple file downloads
* 5. Hold [Enter] on your keyboard so the file is saved immediately once the prompt shows up (filename should be highlighted), there is likely to be many submissions
* NOTE: To abort, you must refresh the page inbetween download prompts, since download prompt has highest priority!
*/
@NovaSagittarii
NovaSagittarii / codeforces-submissions-scraper.js
Last active December 7, 2022 15:50
CodeForces submissions scraper (JS)
// Yoink all AC solution from the Standings page of codeforces, using JS to interact with the site
// Submissions are output as {contestantName}-{submissionId}.txt
/** HOW TO USE
* 1. Go to standings page - https://codeforces.com/group/----/contest/----/standings
* 2. Open JS console (three dots in top right -> [More Tools] -> [Developer Tools] -> [Console])
* 3. Paste code snippet into JS console
* 4. [ALLOW] multiple file downloads
* 5. Hold [Enter] on your keyboard so the file is saved immediately once the prompt shows up (filename should be highlighted), there is likely to be many submissions
*/
(async function(){