Skip to content

Instantly share code, notes, and snippets.

View jonaskuske's full-sized avatar
👀
[[IsHTMLDDA]]

Jonas Kuske jonaskuske

👀
[[IsHTMLDDA]]
View GitHub Profile
@OrionReed
OrionReed / dom3d.js
Last active July 22, 2024 08:58
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@mattiaz9
mattiaz9 / blurhashDataURL.ts
Last active July 19, 2024 05:10
Convert blurhash to a base64 DataURL string (no canvas or node-canvas)
import { decode } from "blurhash"
export function blurHashToDataURL(hash: string | undefined): string | undefined {
if (!hash) return undefined
const pixels = decode(hash, 32, 32)
const dataURL = parsePixels(pixels, 32, 32)
return dataURL
}
@GleasonK
GleasonK / ToggleGTX.ps1
Created February 7, 2022 16:41
Useful Script for Surface Book 2 to toggle off GTX when attempting to detach the screen.
# Useful script for detaching the screen of Surface Book.
# Run if detach light blinks red indicating that it cannot be detached
# since applications are preventing the detach.
#
# Option 1: Copy-paste into powershell window.
#
# Option 2: Run as PowerShell script (requires execution policy change):
# https://superuser.com/questions/106360/how-to-enable-execution-of-powershell-scripts
#
Try {

Yubikey GPG inside WSL2

  1. Install GPG4Win.
  2. Start up Kleopatra (a UI tool from 1) and make sure your YubiKey is loaded there.
    • You can also add GPG4Win to Startup folder using a link with this Target:
      "C:\Program Files (x86)\GnuPG\bin\gpg-connect-agent.exe" /bye
      
      This will only load the agent at Startup, and you won't be bothered by any UI or tray agent.
  3. Download wsl2-ssh-pageant into your Windows %userprofile%/.ssh directory (Windows dir is important for performance).
@slightlyoff
slightlyoff / .eleventy.js
Created August 20, 2020 20:49
image/picture/figure sizing shortcode
// Here's how I use this shortcode in my .md files:
//
// {% picture
// "/2020/06/platform-adjacency-theory/relevance_gap_opt.png",
// "Mind the gap."
// %}
//
// And for the <figure> version that puts the alt text visibly below the image:
//
// {% figure
@daehahn
daehahn / wsl2-network.ps1
Last active June 25, 2024 15:53
WSL 2 TCP NETWORK FORWARDING
# WSL2 network port forwarding script v1
# for enable script, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser' in Powershell,
# for delete exist rules and ports use 'delete' as parameter, for show ports use 'list' as parameter.
# written by Daehyuk Ahn, Aug-1-2020
# Display all portproxy information
If ($Args[0] -eq "list") {
netsh interface portproxy show v4tov4;
exit;
}
@yyx990803
yyx990803 / commits.vue
Last active May 13, 2022 16:43
Vue examples comparisons in 2.x and function-based APIs
<template>
<div id="demo">
<h1>Latest Vue.js Commits</h1>
<template v-for="branch in branches">
<input type="radio"
:id="branch"
:value="branch"
name="branch"
v-model="currentBranch">
<label :for="branch">{{ branch }}</label>
@WebReflection
WebReflection / executable-standalone-module.md
Last active March 4, 2024 20:55
NodeJS Executable Standalone Module

Update

If you're OK in having a node-esm executable, please consider this solution.

#!/usr/bin/env sh
# the /usr/local/bin/node-esm executable
input_file=$1
shift
exec node --input-type=module - $@ &lt;$input_file
async function listenRepeatedly(entity: string, server: Server, port: number) {
for (let i=0; i<10; i++) {
const currentPort = port + i;
try {
await listenOnce(server, currentPort);
console.log(`${entity}: listening at port ${currentPort}.`);
return;
} catch (err) {
if (err.code === 'EADDRINUSE') {
console.log(`${entity}: port ${currentPort} in use, trying next port...`);
@developit
developit / *valoo.md
Last active November 13, 2023 08:39
🐻 Valoo: just the bare necessities of state management. 150b / 120b. https://npm.im/valoo

🐻 valoo

just the bare necessities of state management.

Usage

Hotlink it from https://unpkg.com/valoo.

See Interactive Codepen Demo.