Skip to content

Instantly share code, notes, and snippets.

View quanhua92's full-sized avatar

Quan Hua quanhua92

View GitHub Profile
@quanhua92
quanhua92 / k3s_or_nomad.md
Last active November 30, 2025 06:46
HA Nomad Cluster

Nomad generally uses less CPU and RAM than K3s for the same basic cluster functionality. Nomad is widely regarded as one of the most efficient and lightweight orchestrators available.

For your 5-VPS setup, Nomad's single-binary, minimal approach will result in lower resource utilization and operational overhead compared to K3s, which, despite being "lightweight," still runs the full set of Kubernetes control plane components.

⚖️ Nomad vs. K3s Resource Footprint

The difference in resource consumption stems from the architectural complexity of the two systems.

Resource Nomad Agent (Server/Client) K3s Agent / Server
@quanhua92
quanhua92 / whitelist_bunny.sh
Created August 10, 2022 06:55
Add Bunny.net Edge Server IP Address to UFW firewall
#!/bin/sh
curl -s https://bunnycdn.com/api/system/edgeserverlist -H "Accept: application/json" | jq -r .[] > /tmp/bunny_ips
echo "" >> /tmp/bunny_ips
curl -s https://bunnycdn.com/api/system/edgeserverlist/ipv6 -H "Accept: application/json" | jq -r .[] >> /tmp/bunny_ips
for ip in `cat /tmp/bunny_ips`; do ufw allow proto tcp from $ip comment 'Bunny IP'; done;
@quanhua92
quanhua92 / racknerd_vps_yabs_results.txt
Created December 22, 2021 13:45
Racknerd Blackfriday VPS 3 Cores 4GB Ram 75GB SSD
curl -sL yabs.sh | bash -s -- -r9
3x vCPU Cores
75 GB PURE SSD RAID-10 Storage
4 GB RAM
10,000GB Monthly Premium Bandwidth
1Gbps Public Network Port
Full Root Admin Access
1 Dedicated IPv4 Address
KVM / SolusVM Control Panel - Reboot, Reinstall, Manage rDNS, & much more
@quanhua92
quanhua92 / racknerd_vps_nench_results.txt
Created December 22, 2021 13:30
Racknerd Blackfriday VPS 3 Cores 4GB Ram 75GB SSD
Command:
curl -s wget.racing/nench.sh | bash; curl -s wget.racing/nench.sh | bash
-------------------------------------------------
nench.sh v2019.07.20 -- https://git.io/nench.sh
benchmark timestamp: 2021-12-22 13:27:07 UTC
-------------------------------------------------
Processor: Intel(R) Xeon(R) CPU E5-2697 v2 @ 2.70GHz
CPU cores: 3
@quanhua92
quanhua92 / nanproblem.py
Created October 16, 2020 10:07
NaN problem with DEODR
import torch
import numpy as np
import copy
from deodr import read_obj
from deodr.pytorch import Scene3DPytorch, CameraPytorch
from deodr.pytorch.triangulated_mesh_pytorch import ColoredTriMeshPytorch as ColoredTriMesh
def get_camera(camera_center, width, height, focal=None):
if focal is None:
@quanhua92
quanhua92 / addnoise_asl.m
Created September 8, 2019 02:46
K14513_CD_Files\MATLAB_code\objective_measures\quality
function addnoise_asl(cleanfile, noisefile, outfile, snr)
% ----------------------------------------------------------------------
% This function adds noise to a file at a specified SNR level. It uses
% the active speech level to compute the speech energy. The
% active speech level1 is computed as per ITU-T P.56 standard [1].
%
% Usage: addnoise_asl(cleanFile.wav, noiseFile.wav, noisyFile.wav, SNR)
%
% cleanFile.wav - clean input file in .wav format
% noiseFile.wav - file containing the noise signal in .wav format
@quanhua92
quanhua92 / code.js
Created August 24, 2019 08:02
playerduo hamtruyentv
function scroll_to(pos){
$('html,body').animate({ scrollTop: pos }, 'fast');
}
function scroll_and_grid(current){
scroll_to(9999999); grid(false);
if(current > 0){
scroll_and_grid(current - 1);
"""
This is the implementation of AlexNet which is modified from [Jeicaoyu's AlexNet].
Note:
- The number of Conv2d filters now matches with the original paper.
- Use PyTorch's Local Response Normalization layer which is implemented in Jan 2018. [PR #4667]
- This is for educational purpose only. We don't have pretrained weights for this model.
References:
- Jeicaoyu's AlexNet Model: [jiecaoyu](https://github.com/jiecaoyu/pytorch_imagenet/blob/984a2a988ba17b37e1173dd2518fa0f4dc4a1879/networks/model_list/alexnet.py)
- PR #4667: https://github.com/pytorch/pytorch/pull/4667
"""
"""
This is AlexNet implementation from pytorch/torchvision.
Note:
- The number of nn.Conv2d doesn't match with the original paper.
- This model uses `nn.AdaptiveAvgPool2d` to allow the model to process images with arbitrary image size. [PR #746]
- This model doesn't use Local Response Normalization as described in the original paper.
- This model is implemented in Jan 2017 with pretrained model.
- PyTorch's Local Response Normalization layer is implemented in Jan 2018. [PR #4667]
References:
- Model: https://github.com/pytorch/vision/blob/ac2e995a4352267f65e7cc6d354bde683a4fb402/torchvision/models/alexnet.py
@quanhua92
quanhua92 / alexnet_lrn.py
Created June 17, 2019 06:39
AlexNet: Review and Implementation - deeplearning.vn
"""
This is the implementation of AlexNet which is modified from [Jeicaoyu's AlexNet].
Note:
- The number of Conv2d filters now matches with the original paper.
- Use PyTorch's Local Response Normalization layer which is implemented in Jan 2018. [PR #4667]
- This is for educational purpose only. We don't have pretrained weights for this model.
References: