Skip to content

Instantly share code, notes, and snippets.

@dennislo
dennislo / useful-git-commands.md
Created January 12, 2026 16:51
Useful GIT commands

Useful git commands

Bulk delete branches

List all branches sorted by commit date

git branch -r --sort=-committerdate

Write listed branches sorted by commit date to a file

git branch -r --sort=-committerdate > branches.txt

@dennislo
dennislo / sshKeypairForGitHub.md
Last active March 17, 2026 22:10
SSH keypair setup for GitHub

SSH keypair setup for GitHub

Create a repo.

Make sure there is at least one file in it (even just the README.md)

Generate a SSH key pair (private/public):

ssh-keygen -t rsa -C "your_email@example.com"
@dennislo
dennislo / MySQL_5-7_macOS.md
Created July 13, 2022 08:24
Install MySQL 5.7 on macOS using Homebrew

This is a fork of original gist https://gist.github.com/nrollr/3f57fc15ded7dddddcc4e82fe137b58e, with slight changes on pointing to 5.7 version branch, instead of 8 (latest default of MySQL in Hombrew).

Install MySQL 5.7 on macOS

This procedure explains how to install MySQL using Homebrew on macOS (Sierra 10.12 and up)

Install Homebrew

  • Installing Homebrew is effortless, open Terminal and enter :
    $ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • Note: Homebrew will download and install Command Line Tools for Xcode 8.0 as part of the installation process.
@dennislo
dennislo / listening-tcp-port.md
Created November 18, 2021 20:55
Find ProcessId listening on port.md

lsof -i tcp:5000

@dennislo
dennislo / GitConfig.md
Last active March 17, 2026 22:11
Git config commands

Git config commands

Set GPG sign for each commit

git config --local commit.gpgsign true

Set email

git config --local user.email "lo.dennis@gmail.com"

Set GPG key globally

git config --global user.signingkey ZZZZZZZZZ

@dennislo
dennislo / gpgKeys.md
Last active March 17, 2026 22:31
Generating and maintaining GPG keys
@dennislo
dennislo / docker-commands.md
Last active March 17, 2026 22:31
Docker commands

Docker commands

Display docker version

docker version

Client: Docker Engine - Community
 Cloud integration: 1.0.9
 Version:           20.10.5
 API version:       1.41

Two Reading Modes

According to Streams API, readable streams effectively operate in one of two modes: flowing and paused. A Readable stream can be in object mode or not, regardless of whether it is in flowing mode or paused mode.

  1. In flowing mode, data is read from the underlying system automatically and provided to an application as quickly as possible using events via the EventEmitter interface.

  2. In paused mode, the stream.read() method must be called explicitly to read chunks of data from the stream.

Flow Mode

In a flowing mode, to read data from a stream, it’s possible to listen to data event and attach a callback. When a chunk of data is available, the readable stream emits a data event and your callback executes. Take a look at the following snippet: