Skip to content

Instantly share code, notes, and snippets.

View hzbd's full-sized avatar
I may be slow to respond.

hzbd

I may be slow to respond.
View GitHub Profile
# /app/nginx/conf/nginx.conf
user nginx;
error_log error.log debug;
pid nginx.pid;
load_module modules/ngx_http_acme_module.so;
events {
worker_connections 1024;
multi_accept on;
@hzbd
hzbd / transfer.sh
Last active August 14, 2025 10:09
transfer.sh - Securely transfer files/directories using rsync over SSH. Supports resumable transfers and colored output.
#!/bin/bash
# transfer.sh - Securely transfer files/directories using rsync over SSH.
# Supports resumable transfers and colored output.
# --- Define Colors ---
GREEN='\033[0;32m'
RED='\033[0;31m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
@hzbd
hzbd / Building-GnuPG-2.2.x.md
Created November 6, 2024 00:51 — forked from RogueScholar/Building-GnuPG-2.2.x.md
Compile GnuPG 2.2.27 from source and install on Ubuntu 20.10 and similar Debian-based GNU/Linux distributions

GnuPG 2.2.x Build Instructions

Below are my build/compile instructions for GnuPG 2.2.27, released on Monday, January 11, 2021. These instructions were tested on a working Kubuntu 20.10 "The Groovy Gorilla" desktop environment but should be applicable to all Debian-derivative GNU/Linux distributions since Ubuntu 18.04 LTS "Bionic Beaver." (Go Beavers!)

If you prefer, you may use the install script below to automate the process and install GnuPG 2.2.27 with the following command on your computer's terminal:

curl -L https://mello.link/gnupg2227 | sudo -H bash
@hzbd
hzbd / easyrsa_kit.py
Created September 13, 2024 05:57
easyrsa generate kit
import logging
import os
from datetime import datetime
from os import path
from shutil import rmtree
from subprocess import PIPE, CalledProcessError, Popen
import OpenSSL
import ssl
logger = logging.getLogger(__name__)
@hzbd
hzbd / dnskit.py
Created January 11, 2022 13:22
dns resolver kit.
# -*- coding:utf-8 -*-
import dns
import dns.query
import dns.resolver
import logging
logger = logging.getLogger(__name__)
class Digger(object):
@hzbd
hzbd / delete_action_runs.py
Created January 7, 2022 02:09 — forked from ferstar/delete_action_runs.py
Delete all workflow runs&artifacts of a github repo
import asyncio
import sys
from aiohttp import ClientSession, ClientTimeout
def seq_iter(seq, step=10):
if not seq:
return seq
from_idx, to_idx, seq_len = 0, step, len(seq)
@hzbd
hzbd / 01nginx-tls-sni.md
Created December 8, 2021 15:00 — forked from kekru/01nginx-tls-sni.md
nginx TLS SNI routing, based on subdomain pattern

Nginx TLS SNI routing, based on subdomain pattern

Nginx can be configured to route to a backend, based on the server's domain name, which is included in the SSL/TLS handshake (Server Name Indication, SNI).
This works for http upstream servers, but also for other protocols, that can be secured with TLS.

prerequisites

  • at least nginx 1.15.9 to use variables in ssl_certificate and ssl_certificate_key.
  • check nginx -V for the following:
    ...
    TLS SNI support enabled
@hzbd
hzbd / gitlazy.sh
Last active November 21, 2021 05:13
git lazy bash demo.
#!/bin/bash
#
# Usage:
# gitlazy -c <commit-message> -p <branch>
#
set +x
NOCOLOR='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
@hzbd
hzbd / reqwest_demo.rs
Last active August 17, 2025 07:54
rust reqwest demo with headers
use reqwest::header::{HeaderMap, HeaderName, USER_AGENT, HeaderValue, CONTENT_TYPE};
use serde::{Deserialize, Serialize};
// use serde_json::json;
#[derive(Serialize, Deserialize, Debug)]
struct APIResponse {
http_via: String,
http_x_forwarded_for: String,
client_ip: String,
@hzbd
hzbd / fake_userinfo.json
Created November 5, 2021 07:00
fake user info for jq demo parser.
This file has been truncated, but you can view the full file.
[
{
"_id": "6184d62c13513a212431c661",
"index": 0,
"guid": "146a311b-dbb9-4dd6-b308-43ac5dc5f1c2",
"isActive": true,
"balance": "$3,263.33",
"picture": "http://placehold.it/32x32",
"age": 32,
"eyeColor": "blue",