Skip to content

Instantly share code, notes, and snippets.

@FederalCircle
FederalCircle / react_context_typescript.md
Last active November 29, 2023 15:05
React Context with Typescript

createTypeSafeContext.ts

/**
 * Provides a way to create typesafe contexts without having to check for null
 * initial values all of the time.
 * @see https://react-typescript-cheatsheet.netlify.app/docs/basic/getting-started/context/
 */
export default function createTypeSafeContext<A extends unknown | null>(): readonly [
    () => A & (unknown | null),
    React.Context<A | undefined>
@FederalCircle
FederalCircle / git-cheatsheet.md
Last active December 16, 2024 16:01
Git Cheatsheet

Generating an SSH key with email and filename params

ssh-keygen -t rsa -b 4096 -C "EMAIL" -f ~/.ssh/id_rsa_custom

Add Your SSH Key to the ssh-agent

eval "$(ssh-agent -s)"
@FederalCircle
FederalCircle / postman-deb.sh
Created June 5, 2019 19:31 — forked from SanderTheDragon/postman-deb.sh
A shellscript to create a Postman .deb file, for simple installation on Debian-based Linux distro's. Also creates a .desktop file.
#!/bin/sh
script=`basename "$0"`
if [ $# -gt 0 ] && [ "$1" = "-e" ]; then
e="-e"
fi
echo "Removing old Postman tarballs"
rm -f $(ls Postman*.tar.gz)
@FederalCircle
FederalCircle / touchpad-gestures.sh
Last active March 13, 2019 01:36
Touchpad Gestures at Linux
# Your user must be in the input group
sudo gpasswd -a $USER input
# Then logout from your current session, and login again.
# Install the dependencies
sudo apt-get install xdotool wmctrl libinput-tools
# Clone the repository and execute the script
git clone http://github.com/bulletmark/libinput-gestures
sudo ./libinput-gestures/libinput-gestures-setup install
@FederalCircle
FederalCircle / ubuntu-inotify-watchers.sh
Created March 10, 2019 02:31
Increase the max inotify watcher for Ubuntu. Solve IDE errors about watch files.
# Increase the max inotify watchers count.
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
@FederalCircle
FederalCircle / ubuntu-resolution.sh
Created March 10, 2019 02:16
Add custom resolutions to Ubuntu
# Use this step-by-step tutorial to add new resolution options to Ubuntu display
# settings panel.
# Get the current display name
# Example:
# $ xrandr
# > eDP-1 connected primary...
# 'eDP-1' is the display name
xrandr