Created
March 31, 2023 19:45
-
-
Save pypy-vrc/0700375d53c62ed3a6daacebba6dbbc8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 blonix = (sName, bMaster = false) => { | |
const now = new Date(); | |
// blonix needs to be run at 06:00 ~ 06:59 KST | |
const kst = new Date(now.getTime() + (now.getTimezoneOffset() + 540) * 60000); | |
// if (kst.getHours() !== 6) { | |
// return "----"; | |
// } | |
// bypass :p | |
kst.setHours(6); | |
// generate attendance token | |
let code = 11; | |
for (const s of sName.toLowerCase().split("")) { | |
code += /[a-z]/.test(s) && s.charCodeAt(0) - 96; | |
} | |
code *= sName.length; | |
code *= kst.getMonth() + 21; | |
code *= kst.getDate(); | |
code *= (kst.getDate() % 2) + 1; | |
code *= (kst.getDate() % 3) + 1; | |
// orderly officer flag | |
if (bMaster) { | |
code += 1234; | |
} | |
code %= 10000; | |
return `${code}`; | |
}; | |
console.log(blonix("pypy", true)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment