Skip to content

Instantly share code, notes, and snippets.

View HodoJi's full-sized avatar
:atom:

HodoJi

:atom:
  • Slovakia
  • 00:12 (UTC +02:00)
View GitHub Profile
@HodoJi
HodoJi / install-nodejs-ubuntu-24.04+.md
Created February 12, 2025 09:52
Install NodeJS on Ubuntu 24.04+ and nvm version switching

To install different NodeJS version replace 22 with different version.

# Download and install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
# v0.40.1 of nvm was latest version back then, you can replace it with /master/

# instead of restarting the shell
\. "$HOME/.nvm/nvm.sh"

# Download and install Node.js:
@HodoJi
HodoJi / install_php_sury_debian.sh
Last active February 12, 2025 09:35 — forked from janus57/install_php_sury.sh
Install "deb.sury.org" repository for PHP on Debian
#!/bin/bash
# For up-to-date version see : https://packages.sury.org/php/README.txt
wget https://packages.sury.org/php/apt.gpg -O /usr/share/keyrings/deb.sury.org-php.gpg
echo "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php-sury.list
apt update

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@HodoJi
HodoJi / multiple_ssh_setting.md
Created April 9, 2024 12:42 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "[email protected]"
@HodoJi
HodoJi / multiple-ssh-keys-git.adoc
Created April 9, 2024 12:41 — forked from alejandro-martin/multiple-ssh-keys-git.adoc
Configure multiple SSH Keys for Git

Use Multiple SSH Keys for Git host websites (Github, Gitlab)

This is guide about how to configure multiple SSH keys for some Git host websites such as Github, Gitlab, among others.

Creating SSH keys

  1. Create SSH directory:

@HodoJi
HodoJi / resolve_package-lock.json_conflicts.md
Last active March 15, 2024 06:58 — forked from szemate/package-lock-conflicts.md
How to resolve package-lock.json conflicts

How to resolve package-lock.json conflicts

It is not possible to resolve conflicts of package-lock.json in GitHub's merge tool and you need to do a manual merge.

  1. Update the master branch with the latest changes:
    git checkout master
    git pull
    
  2. Merge your feature branch into master:
@HodoJi
HodoJi / setting_up_cypress_on_wsl2.md
Created March 8, 2024 08:08 — forked from pjobson/setup_cypress_wsl2.md
Setting Up Cypress on Ubuntu WSL2
@HodoJi
HodoJi / consoleColors.js
Last active March 5, 2024 09:31 — forked from abritinthebay/consoleColors.js
The various escape codes you can use to color output to StdOut from Node JS
// Colors reference
// You can use the following as so:
// console.log(colorCode, data);
// console.log(`${colorCode}some colorful text string${resetCode} rest of string in normal color`);
//
// ... and so on.
export const reset = "\x1b[0m"
export const bright = "\x1b[1m"
export const dim = "\x1b[2m"
@HodoJi
HodoJi / random-hash-string-php.md
Last active February 27, 2024 14:20 — forked from umidjons/random-hash-string-php.md
Generate random hash string in PHP

Generate random hash string in PHP

<?php
function randHash(int $len = 32): string
{
	return substr(md5(openssl_random_pseudo_bytes(20)), -$len);
}