Skip to content

Instantly share code, notes, and snippets.

View ntheanh201's full-sized avatar
🌐

The Anh Nguyen ntheanh201

🌐
View GitHub Profile
To add registry mirrors, insecure registries, and more, you can edit the config (daemon.json) by running orb config docker.
Edit `~/.orbstack/config/docker.json`:
{
"insecure-registries": ["http://custom-registry.com"]
}
Restart the orb docker engine: `orb restart docker`
@ntheanh201
ntheanh201 / get-npm-package-version
Created August 28, 2023 09:35 — forked from DarrenN/get-npm-package-version
Extract version from package.json (NPM) using bash / shell
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",[:space:]]//g')
echo $PACKAGE_VERSION
yum provides /usr/sbin/semanage
# CentOS 7
yum install -y policycoreutils-python-2.5-34.el7.x86_64
# CentOS/Rocky Linux 8
yum install -y policycoreutils-python-utils
semanage port -l | grep 9091
@ntheanh201
ntheanh201 / clean_code.md
Created May 3, 2023 09:44 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@ntheanh201
ntheanh201 / alias
Created October 26, 2022 09:38
powerlevel10k alias
-='cd -'
...=../..
....=../../..
.....=../../../..
......=../../../../..
1='cd -1'
2='cd -2'
3='cd -3'
4='cd -4'
5='cd -5'
@ntheanh201
ntheanh201 / fast_reader.go
Last active October 24, 2022 03:43
Golang fast reader standard input
package main
import (
"bufio"
"os"
"regexp"
"strconv"
"strings"
)
@ntheanh201
ntheanh201 / migrate.sh
Created September 18, 2022 13:30
Migrate docker image from Docker Hub to Github Container Registry
#! /bin/bash
read -p "Enter docker image: " image
read -p "Enter source docker image tag: " tag
read -p "Enter target docker image tag: " target_tag
github_user="ntheanh201"
docker_image="$github_user/$image:$tag"
new_image="ghcr.io/$github_user/$image:$target_tag"
server {
listen 8080;
server_name default_server;
access_log /var/www/logs/access.log;
error_log /var/www/logs/error.log;
root /var/www/blind-ls-backend/public;
access_log off;
error_log /var/log/nginx/registration.app-error.log error;
class App extends React.Component {
static contextType = Context
constructor(props, context) {
super(props, context)
// this.context now works
}
1. styled-components: npm install --save styled-components
2. material-ui: npm install @material-ui/core
npm install @material-ui/icons
3. react-chat-window: https://github.com/kingofthestack/react-chat-window
4. Awesome react components: https://github.com/brillout/awesome-react-components