Skip to content

Instantly share code, notes, and snippets.

@peterc
peterc / Caddyfile
Last active March 16, 2024 11:52
Caddyfile for running Mastodon – November 2022 edition
put.your.domain.here {
@local {
file
not path /
}
log {
output file /var/log/caddy/mastodon.log
}
@mueslimak3r
mueslimak3r / jellyfin-caddy-fail2ban-auth
Last active March 6, 2024 19:25
caddy jellyfin fail2ban authentication ban
**caddy config for jellyfin:**
jellyfin.mydomain.com {
reverse_proxy http://192.168.0.1212:2121
log {
output file /var/log/caddy/JellyfinProxy.log {
roll_size 2MiB # Set max size 5 MB
roll_local_time true # Use localhost time
roll_keep 4 # Keep at most 2 log files
@hmil
hmil / tuples.ts
Created September 20, 2018 16:34
Well-typed variable-length tuples in TypeScript
/**
* Arbitrary-length tuples
* =======================
*
* Working with tuples of unknown length in TypeScript is a pain. Most library authors fall back on enumerating all possible
* tuple lengths up to a threshold (see an example here https://github.com/pelotom/runtypes/blob/fe19290d375c8818d2c52243ddc2911c8369db37/src/types/tuple.ts )
*
* In this gist, I'm attempting to leverage recursion to provide support for arbitrary length tuples. This has the potential
* to make some kinds of declarative APIs nicer and enhance type inference in some cases.
* This example shows how to take a variable-length tuple as an input, transform each of its types and use the resulting
/**
* Illustrates how to clone and manipulate MediaStream objects.
*/
function makeAudioOnlyStreamFromExistingStream(stream) {
var audioStream = stream.clone();
var videoTracks = audioStream.getVideoTracks();
for (var i = 0, len = videoTracks.length; i < len; i++) {
audioStream.removeTrack(videoTracks[i]);
}
@dmnsgn
dmnsgn / WebGL-WebGPU-frameworks-libraries.md
Last active June 23, 2024 18:14
A collection of WebGL and WebGPU frameworks and libraries

A non-exhaustive list of WebGL and WebGPU frameworks and libraries. It is mostly for learning purposes as some of the libraries listed are wip/outdated/not maintained anymore.

Engines and libraries ⚙️

Name Stars Last Commit Description
three.js ![GitHub
mkdir ~/.ssh
cd ~/.ssh
PASSWORD=$(openssl rand -base64 30)
if [ "${#PASSWORD}" -ge 20 ]; then
ssh-keygen -b 4096 -P "$PASSWORD" -f id_rsa -o
echo "echo $PASSWORD" > /tmp/askpass.sh
chmod +x /tmp/askpass.sh
export DISPLAY=":0"
export SSH_ASKPASS="/tmp/askpass.sh"
ssh-add -K $HOME/.ssh/id_rsa </dev/null
@amitmerchant1990
amitmerchant1990 / stylish.css
Last active December 28, 2018 00:32
GitHub Fixed Header for better accessibility.
/**
1. Install the Stylish(https://chrome.google.com/webstore/detail/stylish/fjnbnpbmkenffdnngjfgmeleoegfcffe?hl=en) extension for Chrome.
2. Open up extension options and paste the whole CSS mentioned below.
3. Specify the domain name to be `github.com`.
4. Add a title and save.
*/
.header {
padding-top: 10px;
padding-bottom: 10px;
@vbsessa
vbsessa / chrome-devtools.md
Last active June 13, 2024 18:11
How to customize Chrome devtools fonts
  1. Enable #enable-devtools-experiments flag in chrome://flags section.

  2. Open Chorme Devtools and check Settings > Experiments > Allow extensions to load custom stylesheets.

  3. Create the following four files in a dedicated folder.

    3.1. devtools.html

    <html>
    <head></head>
    <body><script src="devtools.js"></script></body>
@cosmith
cosmith / GeolocationModule.java
Created November 1, 2015 23:07
RN Geolocation
package com.yourapp.rctgeolocation;
import android.location.Location;
import android.os.Bundle;
import android.util.Log;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
@paulirish
paulirish / bling.js
Last active May 1, 2024 19:56
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;