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
import { | |
PageSizes, | |
PDFDocument, | |
PDFEmbeddedPage, | |
} from "https://cdn.skypack.dev/pdf-lib@1.17.1?dts"; | |
interface FitPage { | |
page: PDFEmbeddedPage; | |
new_dims: { | |
width: number; |
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
/** | |
* Encrypts plaintext using AES-GCM with supplied password, for decryption with aesGcmDecrypt(). | |
* (c) Chris Veness MIT Licence | |
* | |
* @param {String} plaintext - Plaintext to be encrypted. | |
* @param {String} password - Password to use to encrypt plaintext. | |
* @returns {String} Encrypted ciphertext. | |
* | |
* @example | |
* const ciphertext = await aesGcmEncrypt('my secret text', 'pw'); |
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
javascript:var g_6z; function cI_6z(){ var ctx_6z = new AudioContext(); var el_6z = document.querySelector("video") ? document.querySelector("video") : document.querySelector("audio")? document.querySelector("audio"):alert('Media DOM not exist. Aborting.'); if (el_6z){ g_6z = ctx_6z.createGain(); g_6z.gain.value = 1; var src_6z = ctx_6z.createMediaElementSource(el_6z); src_6z.connect(g_6z).connect(ctx_6z.destination); var p = document.createElement("div"); p.innerHTML = `<div class=vpc_6z id=vpc_6z><style>.vpc_6z{float:right;width:25%;position:fixed;bottom:0;padding:20px 20px;z-index:9999999;background:#444;color:#fff}.vpc_6z-hide{position:fixed;background:#444;padding:0;width:80px;height:30px;bottom:0;z-index:999999}.vpi_6z-hide{display:none}</style><button%20onclick='d=document.getElementById("vpi_6z"),"vpi_6z"==d.getAttribute("class")?d.setAttribute("class","vpi_6z-hide"):d.setAttribute("class","vpi_6z"),c=document.getElementById("vpc_6z"),"vpc_6z"==c.getAttribute("class")?c.setAttribute("class","vpc_6z-hi |
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 program compares same name files of different directories and | |
* outputs differences. Stops comparing if there's no bytes left in any file | |
*/ | |
import { join, resolve } from "https://deno.land/std@0.134.0/path/mod.ts"; | |
const szCHUNK = 512; | |
if (Deno.args.length < 2) { | |
throw new Error("you should provide at least two paths"); |
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://mathworld.wolfram.com/Dice.html | |
const DICE = 2; | |
const SIDES = 6; | |
const ROLLS = 1e6; | |
// init count | |
const count: { [sum: number]: number } = {}; | |
for (let i = DICE; i <= DICE * SIDES; i++) { | |
count[i] = 0; |
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
<input type="file" accept=".json"> | |
<a style="display: none;"></a> | |
<script> | |
/** | |
* The following code should remove duplicate items within a .json vault that was | |
* exported from Bitwarden v1.31.3 and maybe higher (needs more testing). | |
* Once the right .json is provided, it will prompt a dialog to save a non-formatted out.json | |
* | |
* Copyright 2022 ZReC & others |