Skip to content

Instantly share code, notes, and snippets.

View codedeep79's full-sized avatar

Nguyễn Trung Hậu codedeep79

View GitHub Profile
@codedeep79
codedeep79 / Print number using for loop in C.md
Created August 16, 2022 01:24
Print number using for loop in C/C++

Print number 1 pattern using for loop in C/C++

Print number 2 pattern using for loop in C/C++

Print number 3 pattern using for loop in C/C++

Print number 4 pattern using for loop in C/C++

@codedeep79
codedeep79 / Cài đặt Postman trên Debian 11 Bullseye hoặc Debian 10 Buster.md
Last active August 15, 2022 08:12
Cài đặt Postman trên Debian 11 Bullseye hoặc Debian 10 Buster

Update & install Wget

sudo apt update && sudo apt install wget -y

Download Postman on Debian 11

Now download the Postman archive file directly on our Debian 11 Bullseye to download the latest version of the Postman testing tool directly using the command:

wget https://dl.pstmn.io/download/latest/linux64
@codedeep79
codedeep79 / In các kí tự chữ cái bằng vòng lặp for trong C.md
Last active August 15, 2022 04:48
In các chữ cái bằng vòng lặp for trong C/C++

A

B

C

@codedeep79
codedeep79 / Install IntelliJ IDEA using Flatpak for all Linux distributions.md
Created August 13, 2022 05:43
Install IntelliJ IDEA using Flatpak for all Linux distributions

Install Flatpak support on Debian with the following command: sudo apt install flatpak

Download IntelliJ IDEA from Flathub website

Run the command to install IntelliJ IDEA: flatpak install com.jetbrains.IntelliJ-IDEA-Community.flatpakref

@codedeep79
codedeep79 / Disabling the Plymouth Boot Screen.md
Last active August 13, 2022 07:10
Disabling the Plymouth Boot Screen

Edit grub config

In your editor of choice, open the /etc/default/grub file with sudo.

Find the GRUB_CMDLINE_LINUX_DEFAULT line, and you will see:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

To disable the boot screen, simply remove the word splash from this line, like so:

GRUB_CMDLINE_LINUX_DEFAULT="quiet"
@codedeep79
codedeep79 / How do I unlock a user account.md
Created August 12, 2022 15:05
How do I unlock a user account in Ubuntu OS?

Boot into recovery mode

  1. Hold down the shift key or press ESC key when computer starting.
  2. In the grub menu, select the Advanced Options for Ubuntu
  3. On next menu select recovery mode
  4. Then select Root – Drop to root shell prompt
  5. Now an option to enter commands appears at the bottom:
   mount -rw -o remount /
   ls /home
 passwd *username*
@codedeep79
codedeep79 / Linux Error.md
Last active August 11, 2022 03:35
Debian error: Debian stretch "intellij-idea-community: command not found" after successful installation

Add the path into .bashrc file:

echo 'export PATH=$PATH:/snap/bin' >> ~/.bashrc

Open new terminal and execute this command:

source ~/.bashrc
@codedeep79
codedeep79 / Linux Error.md
Last active August 11, 2022 03:36
Debian error: Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is heWaiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 5005 (apt)

Error:

Error: Waiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is heWaiting for cache lock: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 5005 (apt)

Solution

Run in terminal:

sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock*
@codedeep79
codedeep79 / Media change: please insert the disc labeled.md
Last active August 11, 2022 03:36
Debian error: Media change: please insert the disc labeled while install packages in Debian OS

Error:

Media change: please insert the disc labeled
 'Debian GNU/Linux 11.4.0 _Bullseye_ - Official amd64 DVD Binary-1 20220709-10:33'
in the drive '/media/cdrom/' and press [Enter]

Solution:

Just remove the cdrom entry from the sources.list file. This can be done easily: sudo sed -i '/cdrom/d' /etc/apt/sources.list

@codedeep79
codedeep79 / Check if an URL is valid or not using Regular Expression.md
Last active August 9, 2022 03:01
Validate Email Address in C and Check if an URL is valid or not using Regular Expression
#include <iostream>
#include <regex>
using namespace std;

bool isValidURL(string url)
{
  const regex pattern("((http|https)://)(www.)?[a-zA-Z0-9@:%._\\+~#?&//=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%._\\+~#?&//=]*)");

 if (url.empty())