Skip to content

Instantly share code, notes, and snippets.

@palaniraja
Created June 18, 2025 14:06
Show Gist options
  • Save palaniraja/f1c20d6490ec27d06dd6cb501d76eb6a to your computer and use it in GitHub Desktop.
Save palaniraja/f1c20d6490ec27d06dd6cb501d76eb6a to your computer and use it in GitHub Desktop.
my custom scripts for - https://github.com/IvanMathy/Boop
/**
{
"api":1,
"name":"Base64 to bytebuffer",
"description":"Base64 - ByteBuffer",
"author":"palani",
"icon":"01.square.fill",
"tags":"bytebuffer, base64"
}
**/
function main (state) {
state.text = base64ToArrayBuffer(state.text);
}
function getMeByteBuffer(bb) {
return Buffer.from(bb, 'base64').valueOf();
}
function base64ToArrayBuffer(base64) {
var binaryString = atob(base64);
var bytes = new Uint8Array(binaryString.length);
for (var i = 0; i < binaryString.length; i++) {
bytes[i] = binaryString.charCodeAt(i);
}
return bytes.buffer;
}
/**
{
"api":1,
"name":"Convert Epoch to ISO Date",
"description":"Convert Epoch Time to ISOString",
"author":"mehulbaid",
"icon":"clock",
"tags":"convert,time,timezone,isoString,epoch"
}
**/
function main (state) {
state.text = epochToIsoString(state.text);
}
function epochToIsoString(epochString) {
var epoch = parseInt(epochString);
var date = new Date(epoch);
return date.toISOString();
}
/**
{
"api":1,
"name":"(youtube) url encoded query string to JSON",
"description":"youtube links from description",
"author":"palani",
"icon":"01.square.fill",
"tags":"youtube, yt"
}
**/
function yt(input) {
let decoded = decodeURIComponent(input);
// Convert query string to JSON
let params = {};
decoded.split('&').forEach(pair => {
let [key, value] = pair.split('=');
params[key] = value;
});
// Format JSON
return JSON.stringify(params, null, 2);}
function main(input) {
input.text = yt(input.text)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment