Skip to content

Instantly share code, notes, and snippets.

@Tobiaqs
Tobiaqs / store.ts
Last active September 22, 2023 08:49
Vuex 4 store with fully typed mapState (supports modules and actions)
/// store.ts
import { InjectionKey } from 'vue'
import { createStore, mapState as baseMapState, Store, useStore as baseUseStore } from 'vuex'
const modules = {
appDataModule,
}
const state = {
settings: <Settings | null>null,
@Tobiaqs
Tobiaqs / heroicons.ts
Last active March 1, 2024 09:14
Heroicons lookup utility for Vue 3
// Needs "@heroicons/vue": "2.x"
import * as heroiconsSolid16 from '@heroicons/vue/16/solid'
import * as heroiconsSolid20 from '@heroicons/vue/20/solid'
import * as heroiconsOutline24 from '@heroicons/vue/24/outline'
import * as heroiconsSolid24 from '@heroicons/vue/24/solid'
function getHeroicon<T extends keyof typeof heroiconsSolid16>(size: 'solid16', name: keyof typeof heroiconsSolid16): (typeof heroiconsSolid16)[T]
function getHeroicon<T extends keyof typeof heroiconsSolid20>(size: 'solid20', name: keyof typeof heroiconsSolid20): (typeof heroiconsSolid20)[T]
function getHeroicon<T extends keyof typeof heroiconsSolid24>(size: 'solid24', name: keyof typeof heroiconsSolid24): (typeof heroiconsSolid24)[T]
@Tobiaqs
Tobiaqs / kpn.ts
Created April 21, 2024 13:52
KPN get extra 2GB Puppeteer
import puppeteer from 'puppeteer'
;(async () => {
// Launch the browser and open a new blank page
const browser = await puppeteer.launch()
const page = await browser.newPage()
// Navigate the page to a URL
await page.goto('https://mijn.kpn.com/')
@Tobiaqs
Tobiaqs / vapid.py
Created May 1, 2024 08:39
Generate VAPID keys
# Based on https://gist.github.com/cjies/cc014d55976db80f610cd94ccb2ab21e
import base64
import ecdsa
def generate_vapid_keypair():
"""
Generate a new set of encoded key-pair for VAPID
"""
pk = ecdsa.SigningKey.generate(curve=ecdsa.NIST256p)
// ==UserScript==
// @name Notion Alt+C print published page
// @namespace https://leanslate.nl/
// @version 2024-05-29
// @description Use Alt+C to properly print a PDF from a published Notion page
// @author Tobias
// @match https://*.notion.site/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=notion.so
// @grant none
// ==/UserScript==