Skip to content

Instantly share code, notes, and snippets.

View devtdq1701's full-sized avatar
🎯
Focusing

Trần Đăng Quang devtdq1701

🎯
Focusing
  • Hà Nội
  • 12:24 (UTC +07:00)
View GitHub Profile

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.

Setup multiple git identities & git user informations

/!\ Be very carrefull in your setup : any misconfiguration make all the git config to fail silently ! Go trought this guide step by step and it should be fine 😉

Setup multiple git ssh identities for git

  • Generate your SSH keys as per your git provider documentation.
  • Add each public SSH keys to your git providers acounts.
  • In your ~/.ssh/config, set each ssh key for each repository as in this exemple:
@devtdq1701
devtdq1701 / clean.sh
Created April 21, 2025 15:13 — forked from Iman/clean.sh
Free up disk space on Ubuntu - clean log, cache, archive packages/apt archives, orphaned packages, old kernel and remove the trash
#!/bin/sh
#Check the Drive Space Used by Cached Files
du -sh /var/cache/apt/archives
#Clean all the log file
#for logs in `find /var/log -type f`; do > $logs; done
logs=`find /var/log -type f`
for i in $logs
sudo apt update
sudo apt install build-essential
sudo apt install libssl-dev
export OPENSSL_ROOT_DIR=/usr/include/openssl
wget https://cmake.org/files/v3.29/cmake-3.29.2.tar.gz
tar -xzvf cmake-3.29.2.tar.gz
cd cmake-3.29.2
./bootstrap
make -j$(nproc)
sudo make install
@devtdq1701
devtdq1701 / del-ubuntu.md
Created July 29, 2024 08:26 — forked from lelinhtinh/del-ubuntu.md
Những tùy chỉnh và ứng dụng Ubuntu mình đang dùng
@devtdq1701
devtdq1701 / java-setup.md
Created December 10, 2023 03:35 — forked from starlinq/java-setup.md
How to install Java JDK8 in Ubuntu 16.04

How to install Java JDK8 in Ubuntu 16.04

Let's consider a JDK8 installation using 2 different versions: default and Oracle. The default version is easiest because it is packaged with Ubuntu.

There is default Java installation called the JDK (Java Development Kit). The JDK is usually only needed if you are going to to do some software developmwent using Java or if some software requires it. The JDK does contain the JRE.

Installing the default JDK

@devtdq1701
devtdq1701 / iowait-linux.md
Created October 19, 2023 14:49 — forked from tcpdump-examples/iowait-linux.md
How to Fix io wait issue in Linux

Linux high IOwait is a common Linux performance issue. Today we will look at what iowait means and what contributes to this problem. Hope this can give you more ideas about high IOwait issue.

What is IOwait?

IO wait is related to the CPU resource on the server.

The iowait column on top command output shows the percentage of time that the processor was waiting for I/O to complete. It indicates that the system is waiting on disk or network IO. Because the system is waiting on those resources, it can not fully utilize the CPU.

Learn more about what IOwait here.

@devtdq1701
devtdq1701 / config
Created August 19, 2023 12:28 — forked from pksunkara/config
Sample of git config file (Example .gitconfig) (Place them in $XDG_CONFIG_HOME/git)
[user]
name = Pavan Kumar Sunkara
email = [email protected]
username = pksunkara
[init]
defaultBranch = master
[core]
editor = nvim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
pager = delta
@devtdq1701
devtdq1701 / #tg_conv_bot.md
Created August 6, 2023 18:31 — forked from aahnik/#tg_conv_bot.md
A simple conversation bot that will ask user's name, and save it. Persistent, Polling, Shows Button, Has conversation flow, Conversation Handler, python-telegram-bot, ptb,

How to run

  1. Install dependancies.
pip3 install python-dotenv python-telegram-bot
  1. Then put the files of this gist inside a folder.
@devtdq1701
devtdq1701 / Remove-OldIISLogs.ps1
Created July 15, 2023 11:25 — forked from mortenya/Remove-OldIISLogs.ps1
Script to run as a Scheduled Task to clean out IIS logs older than 30 days.
<#
Shamelessly liberated from http://foxdeploy.com/2015/02/11/automatically-delete-old-iis-logs-w-powershell/
Because it was better than my own.
#>
$LogPath = "C:\inetpub\logs"
$maxDaystoKeep = -30
$outputPath = "c:\CleanupTask\Cleanup_Old_logs.log"
$itemsToDelete = dir $LogPath -Recurse -File *.log | Where LastWriteTime -lt ((get-date).AddDays($maxDaystoKeep))