Skip to content

Instantly share code, notes, and snippets.

@ivangabriele
ivangabriele / index.md
Last active November 8, 2018 19:54
Typescript useful functions & helpers list.

Typescript Useful Functions & Helpers

Objects

type Diff<T extends string, U extends string> = ({[P in T]: P } & {[P in U]: never } & { [x: string]: never })[T]
type Omit&gt; = Pick, K&gt;&gt;
@ivangabriele
ivangabriele / awesome-git-config.md
Last active May 31, 2022 20:06
Awesome Git Config.

Add those to you ~/.gitconfig (or %HOMEPATH%/.gitconfig under Windows):

[advice]
	skippedCherryPicks = false
	useCoreFSMonitorConfig = false

[alias]
	# Common aliases:
	br = branch
@ivangabriele
ivangabriele / ubuntu-cheatsheet.md
Last active March 18, 2019 09:58
Ubuntu Cheat Sheet

Global

Distribution

cat /proc/version

Aliases

@ivangabriele
ivangabriele / post-receive
Last active August 22, 2021 14:16
Github Post Receive Hook
#!/bin/bash
# Exit when any command fails:
set -e
TARGET="/home/.../deployments/matomo"
GIT_DIR="/home/.../repositories/matomo.git"
BRANCH="main"
while read oldrev newrev ref
@ivangabriele
ivangabriele / docker-cheatsheet.md
Last active February 1, 2022 07:50
Commonly used Docker commands cheat sheet.

List all containers (only IDs)

docker ps -aq

Stop all running containers

docker stop $(docker ps -aq)

Remove all containers

Backup

ssh [user]@[ip]
cd [server_project_path]
docker-compose exec -T db pg_dump -U [db_user] -Fc [db_name] -f /[file].dump
docker ps
@ivangabriele
ivangabriele / .bash_profile
Last active November 7, 2019 06:38
Bash profile for MacOS
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@ivangabriele
ivangabriele / cloudSettings
Last active April 5, 2021 23:09
My very own VS Code settings.
{"lastUpload":"2021-04-05T23:09:05.386Z","extensionVersion":"v3.4.3"}
@ivangabriele
ivangabriele / nix-installation-and-running-on-macos-catalina.md
Last active February 4, 2020 23:17
Nix installation and running on macOS Catalina (10.15)

First Installation

Following this known issue:

  1. Run:
    echo 'nix' | sudo tee -a /etc/synthetic.conf
  2. Reboot
  3. Run: