Skip to content

Instantly share code, notes, and snippets.

View lpolon's full-sized avatar
Working from home

Leonardo lpolon

Working from home
View GitHub Profile
mjackson /
Last active November 12, 2023 07:32
Notes on handling redirects in React Router v6, including a detailed explanation of how this improves on what we used to do in v4/5

Redirects in React Router v6

An important part of "routing" is handling redirects. Redirects usually happen when you want to preserve an old link and send all the traffic bound for that destination to some new URL so you don't end up with broken links.

The way we recommend handling redirects has changed in React Router v6. This document explains why.


In React Router v4/5 (they have the same API, you can read about why we had to bump the major version here) we had a <Redirect> component that you could use to tell the router when to automatically redirect to another URL. You might have used it like this:

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.


Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}
Readme: In the following pseudo code, [] indicates a subroutine.
Sometimes I choose to write the subroutine inline under the [] in order to maintain context.
One important fact about the way rollbacks are handled here is that we are storing state for every frame.
In any real implementation you only need to store one game state at a time. Storing a game
state for every frame allows us to only rollback to the first frame where the predicted inputs don't match the true ones.
MAX_ROLLBACK_FRAMES := Any Positive Integer # Specifies the maximum number of frames that can be resimulated
FRAME_ADVANTAGE_LIMIT := Any Positive Integer # Specifies the number of frames the local client can progress ahead of the remote client before time synchronizing.
jamesmacfie /
Created October 22, 2019 02:53
iTerm 2 - script to change theme depending on Mac OS dark mode

How to use

In iTerm2, in the menu bar go to Scripts > Manage > New Python Script

Select Basic. Select Long-Running Daemon

Give the script a decent name (I chose

Save and open the script in your editor of choice.

augustocdias /
Last active October 18, 2021 22:27
Sennheiser GSX 1000/1200 on Linux

UPDATE: this is out of date and although it worked for me at the time, there is a better solution to make it work:

In order to make the Sennheiser amplifier GSX 1000/1200 work on Linux as a 7.1 device it is needed to change a configuration file of pulseaudio. Execute this command to identify the output sound cards:

aplay -l

This is a sample output