Skip to content

Instantly share code, notes, and snippets.

@ailequal
ailequal / random-tips-and-tricks.md
Created January 20, 2024 08:50
random-tips-and-tricks

json schema

To use a local json schema inside your project with Visual Studio Code create a .vscode folder and a settings.json file inside it. Then set the following configuration tuned up for your specific needs:

{
@ailequal
ailequal / git-backup.sh
Created November 8, 2023 06:49
git-backup
#!/bin/bash
##############
# git-backup #
##############
# Inside the "repos.txt" file, set the repositories names, one per line.
# The target folder is always generated in the current directory where the script is executed.
# Inside the new folder, each repository will be stored inside a tar.gz archive.
# Each repository is cloned as a mirror, so you can push it to a new remote.
@ailequal
ailequal / getValueFromPath.ts
Last active July 13, 2023 10:01
getValueFromPath
/**
* Retrive the specific value from an object, given the property path separated by a splitter.
* The generic defines the expected return type.
* Beware that, for example, defining a generic "string" won't assure us
* that the value from the object will have the same type. We are "trusting" the object.
*
* @param object
* @param path
* @param splitter
*/
@ailequal
ailequal / npm-tips-and-tricks.md
Last active April 6, 2024 10:46
npm tips and tricks

package.json

engines

It's good practice to set the required node and npm version for your project. To do so add to the package.json:

"engines": {
  "npm": ">=9.0.0 <10.0.0",
  "node": ">=18.0.0 <19.0.0"
}
@ailequal
ailequal / tp-link-ac600-ac1300-drivers-linux.md
Created May 17, 2023 11:35 — forked from julianlam/tp-link-ac600-ac1300-drivers-linux.md
Installing drivers for the TP-Link T2U/T3U Plus (AC600 or AC1300) Wireless Adapter #blog
@ailequal
ailequal / pinger.sh
Last active November 8, 2023 06:50
pinger
#!/bin/bash
#############
# pinger.sh #
#############
# Ping every 30 seconds "192.168.0.1".
# If the ping fails, play a sound for alerting the user.
# The loop can only be stopped manually by the user.
@ailequal
ailequal / range.ts
Created February 22, 2023 17:42
range
/**
* A simple range function.
*
* @param start
* @param end
* @param step
*/
export default (start: number, end?: number, step: number = 1): number[] => {
const output = [];
@ailequal
ailequal / x11_forwarding_macos_docker.md
Last active January 23, 2024 19:41 — forked from sorny/x11_forwarding_macos_docker.md
X11 forwarding with macOS and Docker

X11 forwarding on macOS and docker

A quick guide on how to setup X11 forwarding on macOS when using docker containers requiring a DISPLAY.

This guide was tested on:

  • macOS Catalina 10.15.4
  • docker desktop 2.2.0.5 (43884) - stable release
  • XQuartz 2.7.11 (xorg-server 1.18.4)

Step-By-Step Guide

@ailequal
ailequal / reset.css
Last active February 22, 2023 17:43
CSS reset
/*
1. Use a more-intuitive box-sizing model.
*/
*, *::before, *::after {
box-sizing: border-box;
}
/*
2. Remove default margin
*/
@ailequal
ailequal / ssh-key-setup.md
Last active June 12, 2023 07:00
SSH key setup

linux-ssh preliminary setup

Nothing (usually).

macos-ssh preliminary setup

macOS won't automatically add our keys (especially if protected by a passphrase) to the ssh agent. In order to fix this, we will open Automator and create a new shell script: Automator > Application > Run Shell Script. The content is the following:

# add all keys inside "~/.ssh" into the ssh-agent and discard the output
ssh-add -A 2> /dev/null