Skip to content

Instantly share code, notes, and snippets.

View jespertheend's full-sized avatar

Jesper van den Ende jespertheend

View GitHub Profile
@jespertheend
jespertheend / vec2ToByte.js
Last active March 15, 2024 20:27
A function that allows you to convert a 2d vector into a single byte and back into a vector. Useful when you want to send player joystick input over the network.
import { mod, Vec2 } from "https://cdn.jsdelivr.net/npm/renda@0.3.0/dist/renda.min.js";
const RING_SEGMENTS = 36;
const RING_COUNT = 7;
// https://www.desmos.com/calculator/zpob0tj445
/**
* Normalizes a Vec2 (between -1 and 1) and returns a byte (a value between 0 and 255)
* which can be used to turn it back into a Vec2 using {@linkcode byteToVec2d}.
@jespertheend
jespertheend / WebSocketLatency.js
Last active March 22, 2024 10:17
Simulate latency and intermittent connection drops on WebSockets.
// ==UserScript==
// @name WebSocket latency tester
// @namespace https://jespertheend.com/
// @version 0.0.2
// @description Simulate latency and intermittent connection drops on WebSockets.
// @author Jesper van den Ende
// @match *://*/*
// @grant none
// @run-at document-start
// ==/UserScript==
@jespertheend
jespertheend / canary.js
Last active March 20, 2023 09:00
Ubuntu Chromium Canary
#!/usr/bin/env -S deno run --allow-run --allow-read --allow-write --allow-net
/**
* @fileoverview Downloads the latest Linux Chromium development build from Googles servers and then runs it.
* When a build has already been downloaded, it first runs that version and then downloads a new version in the background.
* Only works on Linux. If you are using Windows or macOS you can get Nightly builds from https://www.google.com/chrome/canary/
*
* ## Usage
*
* ```
@jespertheend
jespertheend / replaceWhatsappWebNotificationSound.js
Last active July 15, 2020 20:37
paste this in the browser console then drag an audio file to the page to replace the notification sound
(async function(){
async function writeSound(cache, url){
const el = document.createElement("div");
document.body.appendChild(el);
el.style.background = "white";
el.style.width = el.style.height = "100%";
el.style.position = "absolute";
el.style.zIndex = 1000;
el.textContent = "drag an audio file to this page";
el.addEventListener("dragover", e => e.preventDefault());
@jespertheend
jespertheend / scammerspammer2.user.js
Last active July 17, 2023 12:33
Install Tampermonkey and click the raw button on this page to install. Then visit https://zap424569-1.plesk06.zap-webspace.com/ in your browser to scam the spammer.
// ==UserScript==
// @name Scammer Spammer 2
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Visit https://zap424569-1.plesk06.zap-webspace.com/ in your browser to scam the spammer.
// @author Jesper van den Ende
// @match https://zap424569-1.plesk06.zap-webspace.com/
// @grant none
// @downloadUrl https://gist.github.com/jespertheend/543f81b2119efcb51e913f946b27a7f6/raw/scammerspammer2.user.js
// @updateUrl https://gist.github.com/jespertheend/543f81b2119efcb51e913f946b27a7f6/raw/scammerspammer2.user.js
@jespertheend
jespertheend / simple-https-server.py
Last active September 28, 2019 21:32 — forked from dergachev/simple-https-server.py
Fork from https://gist.github.com/dergachev/7028596 with one change that allows for sending POST requests. It basically handles them the same as GET requests and doesn't give an error anymore :)
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.pem with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl

Keybase proof

I hereby claim:

  • I am jespertheend on github.
  • I am jespertheend (https://keybase.io/jespertheend) on keybase.
  • I have a public key ASBPcJKwpCXRt4EnRlPxvXqpKVe9dbhsRCqgCgWIPp-npgo

To claim this, I am signing this object:

#pragma once
// openvr.h
//========= Copyright Valve Corporation ============//
// Dynamically generated file. Do not modify this file directly.
#ifndef _OPENVR_API
#define _OPENVR_API
#include <stdint.h>
@jespertheend
jespertheend / keybase_proof.txt
Created April 9, 2016 13:31
keybase.io proof
### Keybase proof
I hereby claim:
* I am jespertheend on github.
* I am jespertheend (https://keybase.io/jespertheend) on keybase.
* I have a public key whose fingerprint is 08D5 2434 E5E8 DD74 4902 6BC6 F59C 838F 6037 999F
To claim this, I am signing this object: