Skip to content

Instantly share code, notes, and snippets.

View mstoecklein's full-sized avatar
📡
Sending signals to the world. I'm alive!

Mario Stöcklein mstoecklein

📡
Sending signals to the world. I'm alive!
  • Germany
  • 21:27 (UTC +02:00)
View GitHub Profile
@mstoecklein
mstoecklein / kdbxweb-argon2.js
Created March 29, 2023 02:54
Ugly, but it works
const argonmod = () => {
var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else{throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_N
@mstoecklein
mstoecklein / tag-test.kdbx
Created March 29, 2023 02:01
The test file should have tags in the group, but unfortunately it does not.
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<KeePassFile>
<Meta>
<Generator>KdbxWeb</Generator>
<SettingsChanged>2023-03-29T01:42:17Z</SettingsChanged>
<DatabaseName>title</DatabaseName>
<DatabaseNameChanged>2023-03-29T01:42:17Z</DatabaseNameChanged>
<DatabaseDescription />
<DatabaseDescriptionChanged>2023-03-29T01:42:17Z</DatabaseDescriptionChanged>
<DefaultUserName />
@mstoecklein
mstoecklein / cachedFetch.ts
Created January 12, 2023 16:48
Wraps the fetch request with a Cache
// Copilot told me, it found this code somewhere in one of 0xflotus repos
// thx btw!
export const cachedFetch =
(cache: Cache) => (input: string | Request | URL, init?: RequestInit) => {
const request = new Request(input, init);
return cache.match(request).then((response) => {
if (response) {
return response;
}
return fetch(request).then((response) => {
@mstoecklein
mstoecklein / globals.d.ts
Last active January 13, 2023 03:05
Polyfill type declaration to use service worker types in a deno environment
// Polyfill type declaration to use service worker types in a deno environment
interface FetchEvent extends Event {
request: Request;
respondWith(response: Promise<Response> | Response): void;
}
interface GlobalEventHandlersEventMap {
fetch: FetchEvent;
}
@mstoecklein
mstoecklein / MockCache.ts
Last active January 12, 2023 13:20
Mock the Cache for browser/service worker tests
/**
* A mock cache implementation for use in tests.
* @see https://developer.mozilla.org/en-US/docs/Web/API/Cache
*
* Developed by Mario Stöcklein
* @see https://gist.github.com/mstoecklein/dd7a62cd815e0258d3ee129803d0d707
*/
export class MockCache implements Cache {
private cache: Map<Request, Response> = new Map();
@mstoecklein
mstoecklein / calendar-graph-hack.js
Last active January 12, 2023 14:44
Creates a glitch in the Matrix in your GitHub profile ;-)
// ==UserScript==
// @name Calender Graph Hack
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Just for fun
// @author Mario Stöcklein (https://github.com/mstoecklein)
// @match https://github.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=github.com
// @grant none
// ==/UserScript==
@mstoecklein
mstoecklein / download-chatgpt.js
Last active January 12, 2023 15:01
ChatGPT conversation plaintext downloader
// ==UserScript==
// @name ChatGPT Conversation Download Button
// @description Download a conversation with ChatGPT
// @author Mario Stöcklein (https://github.com/mstoecklein)
// @namespace https://chat.openai.com/
// @match https://chat.openai.com/*
// @version 1
// ==/UserScript==
// https://chat.openai.com/backend-api/conversations?offset=0&limit=20