Skip to content

Instantly share code, notes, and snippets.

Avatar
📔
school school school busy busy help with homework please

--Explosion-- Explosion-Scratch

📔
school school school busy busy help with homework please
View GitHub Profile
@Explosion-Scratch
Explosion-Scratch / Password generator using master password.js
Created Nov 28, 2021
Generates passwords using a master password and the domain name.
View Password generator using master password.js
(async () => {
// canary.discord.com ⇒ discord.com
let hashed = await hash(`${location.hostname.split(".").slice(-2).join(".")} $ ${await passwd()}`);
navigator.clipboard.writeText(hashed);
[...document.querySelectorAll("input[type='password']")].forEach(i => (i.value = hashed));
//Async hashes using crypto API 😎
async function hash(string) {
// SHA-256 is better but generates too long passwords.
var buffer = await crypto.subtle.digest("SHA-1", new TextEncoder().encode(string));
//Make it have some symbols and stuff
@Explosion-Scratch
Explosion-Scratch / Top 1m.json
Last active Nov 25, 2021
The top 1 million sites.
View Top 1m.json
["google.com","youtube.com","tmall.com","qq.com","baidu.com","sohu.com","taobao.com","360.cn","amazon.com","jd.com","facebook.com","yahoo.com","wikipedia.org","weibo.com","zoom.us","sina.com.cn","xinhuanet.com","live.com","microsoft.com","office.com","reddit.com","panda.tv","netflix.com","instagram.com","zhanqi.tv","google.com.hk","canva.com","csdn.net","myshopify.com","alipay.com","force.com","microsoftonline.com","vk.com","yahoo.co.jp","coinmarketcap.com","stackoverflow.com","naver.com","linkedin.com","bongacams.com","twitter.com","adobe.com","tianya.cn","bing.com","yy.com","ebay.com","huanqiu.com","salesforce.com","chaturbate.com","amazon.in","twitch.tv","whatsapp.com","aliexpress.com","amazon.co.jp","yandex.ru","17ok.com","1688.com","mail.ru","tiktok.com","dropbox.com","tradingview.com","wordpress.com","discord.com","aparat.com","tribunnews.com","babytree.com","etsy.com","msn.com","chase.com","indeed.com","zoho.com","walmart.com","spotify.com","upwork.com","google.co.in","freepik.com","amazonaws.com","pik
@Explosion-Scratch
Explosion-Scratch / Tiny helpers.json
Created Nov 21, 2021
A total JSON list of all the tiny helpers from stefanjudis/tiny-helpers
View Tiny helpers.json
{
"0to255.json": {
"name": "0to255",
"desc": "Lighten and darken colors easily",
"url": "https://www.0to255.com/",
"tags": [
"Color"
],
"maintainers": [],
"addedAt": "2020-01-24"
@Explosion-Scratch
Explosion-Scratch / Remove watch later.js
Created Nov 4, 2021
Remove all videos from watch later (YouTube)
View Remove watch later.js
PLEASE_STOP = false;
//set PLEASE_STOP to true to stop removing videos
while (window.PLEASE_STOP === false) {
document.querySelector("ytd-playlist-video-renderer .yt-icon-button").click();
await new Promise((r) => setTimeout(r, 100));
[...document.querySelectorAll("ytd-menu-popup-renderer tp-yt-paper-item")]
.find((i) => i.innerText.includes("Remove from"))
.click();
await new Promise((r) => setTimeout(r, 400));
}
@Explosion-Scratch
Explosion-Scratch / Authenticator.js
Created Nov 2, 2021
Generates an authenticator token based on a secret key. (Usually given in the QR code that apps have you scan)
View Authenticator.js
async function getToken(key, options) {
let { default: JsSHA } = await import(
"https://cdn.skypack.dev/pin/jssha@v3.2.0-7ih4rHNyCNAz1Lqwkzy4/mode=imports,min/optimized/jssha.js"
);
options = {
period: 30,
algorithm: "SHA-1",
digits: 6,
timestamp: Date.now(),
...options,
@Explosion-Scratch
Explosion-Scratch / Compress string.js
Created Nov 1, 2021
Compress string using gzip and native browser APIs
View Compress string.js
function compress(string, encoding) {
const byteArray = new TextEncoder().encode(string);
const cs = new CompressionStream(encoding);
const writer = cs.writable.getWriter();
writer.write(byteArray);
writer.close();
return new Response(cs.readable).arrayBuffer();
}
function decompress(byteArray, encoding) {
@Explosion-Scratch
Explosion-Scratch / Favicon counter.js
Last active Oct 16, 2021
Shows a number in the favicon like Discord and Gmail do.
View Favicon counter.js
/**
* Generates a data URL of the current favicon with a number added on top.
* @param {Object} options
* @param {String} [options.type = "image/png"] The mime type of the image to return.
* @param {String} [options.text = ""] The text to display on the favicon, if left blank will simply show a dot on the favicon.
* @param {String} [options.background = "white"] A CSS color for the background of the notification badge.
* @param {String} [options.color = "white"] A CSS color for the color of the text on the notification badge.
* @param {Number} [options.size = 10] The size of the notification badge. The badge generated will be size * 2 pixels in width and height, then added on top of the current favicon.
* @param {String} [options.pos = "bottom-right"] The position of the badge, either "bottom-right", "top-right", "bottom-left" or "top-left"
* @param {String} [options.font = "Monospace"] The font to use
@Explosion-Scratch
Explosion-Scratch / Quizlet flashcards.js
Created Oct 12, 2021
Get Quizlet flashcards via API
View Quizlet flashcards.js
async function quizlet(id){
let res = await fetch(`https://quizlet.com/webapi/3.4/studiable-item-documents?filters%5BstudiableContainerId%5D=${id}&filters%5BstudiableContainerType%5D=1&perPage=5&page=1`).then(res => res.json())
let currentLength = 5;
let token = res.responses[0].paging.token
let terms = res.responses[0].models.studiableItem;
let page = 2;
console.log({token, terms})
while (currentLength >= 5){
let res = await fetch(`https://quizlet.com/webapi/3.4/studiable-item-documents?filters%5BstudiableContainerId%5D=${id}&filters%5BstudiableContainerType%5D=1&perPage=5&page=${page++}&pagingToken=${token}`).then(res => res.json());
terms.push(...res.responses[0].models.studiableItem);
@Explosion-Scratch
Explosion-Scratch / mediastream.js
Last active Oct 12, 2021
Greenscreen effect on media stream using canvas
View mediastream.js
//Helper functions:
// get('type', stream) returns the audio or video track from a stream.
// createStream(...tracks) returns a stream with all the tracks provided as parameters
async function manipulate(videoTrack, fn) {
let canvas = document.createElement("canvas");
let running = true;
const ctx = canvas.getContext("2d");
let video = document.createElement("video");
video.setAttribute("autoplay", true);
video.setAttribute("muted", true);
View ripple.js
function ripple(el, opts = {}) {
const time = opts.time || (+el.getAttribute("data-time") || 1000) * 3;
const color = opts.color || el.getAttribute("data-color") || "currentColor";
const opacity = opts.opacity || el.getAttribute("data-opacity") || ".3";
const event = opts.event || el.getAttribute("data-event") || "click";
el.style.overflow = "hidden";
el.style.position = "relative";
el.addEventListener(event, (e) => {
if (el.disabled) return;
var ripple_div = document.createElement("DIV");