Skip to content

Instantly share code, notes, and snippets.

View caocuong2404's full-sized avatar
🌍
Have a nice day

Nguyen Cao Cuong - Peter James caocuong2404

🌍
Have a nice day
View GitHub Profile
@caocuong2404
caocuong2404 / nerd_fonts.md
Created June 5, 2023 03:36 — forked from davidteren/nerd_fonts.md
Install Nerd Fonts via Homebrew [updated & fixed]
@caocuong2404
caocuong2404 / Dockerfile
Created May 22, 2023 04:30 — forked from rosskevin/Dockerfile
nginx envsubst escape $
FROM nginx:alpine
# https://thepracticalsysadmin.com/templated-nginx-configuration-with-bash-and-docker/
ENV LISTEN_PORT=80 \
NGINX_ENV=production \
SERVER_NAME=_ \
RESOLVER=8.8.8.8 \
UPSTREAM_API=api:3000 \
UPSTREAM_API_PROTO=http \
WORKDIR=/www \
@caocuong2404
caocuong2404 / webcryptoapi.html
Created May 12, 2023 07:29 — forked from deiu/webcryptoapi.html
Web Crypto API example: RSA keygen & export & import & sign & verify & encrypt & decrypt
<!-- MIT License -->
<html>
<head>
<script>
function generateKey(alg, scope) {
return new Promise(function(resolve) {
var genkey = crypto.subtle.generateKey(alg, true, scope)
genkey.then(function (pair) {
resolve(pair)
})
# make dock faster
defaults write com.apple.dock autohide-delay -float 0; killall Dock
# install brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
(echo; echo 'eval "$(/usr/local/bin/brew shellenv)"') >> ~/.zshrc
zsh
@caocuong2404
caocuong2404 / hosts.ps1
Created April 27, 2023 03:29 — forked from markembling/hosts.ps1
Powershell script for adding/removing/viewing entries to the hosts file.
#
# Powershell script for adding/removing/showing entries to the hosts file.
#
# Known limitations:
# - does not handle entries with comments afterwards ("<ip> <host> # comment")
#
$file = "C:\Windows\System32\drivers\etc\hosts"
function add-host([string]$filename, [string]$ip, [string]$hostname) {
# backup files from a docker volume into /tmp/backup.tar.gz
function docker-volume-backup-compressed() {
docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie tar -czvf /backup/backup.tar.gz "${@:2}"
}
# restore files from /tmp/backup.tar.gz into a docker volume
function docker-volume-restore-compressed() {
docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie tar -xzvf /backup/backup.tar.gz "${@:2}"
echo "Double checking files..."
docker run --rm -v /tmp:/backup --volumes-from "$1" debian:jessie ls -lh "${@:2}"
@caocuong2404
caocuong2404 / ubuntu-server-setup.sh
Created November 7, 2022 02:50
Some commands help you set up the server when the first time logged
sudo apt update
sudo apt upgrade
sudo sh -c "$(curl -fsSL https://starship.rs/install.sh)" -y -f
echo 'eval "$(starship init bash)"' >> ~/.bashrc
bash

Keybase proof

I hereby claim:

  • I am caocuong2404 on github.
  • I am caocuong2404 (https://keybase.io/caocuong2404) on keybase.
  • I have a public key ASAGrF4VukD9VsnSJP5qj06RR7uYU6zn9dG34kCltoVuwwo

To claim this, I am signing this object: