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
@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 / 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 June 6, 2024 05:27
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",
@hzbd
hzbd / tinyproxy.conf
Created November 1, 2021 17:39 — forked from Pk13055/tinyproxy.conf
Config file for tinyproxy https://tinyproxy.github.io/
##
## tinyproxy.conf -- tinyproxy daemon configuration file
##
## This example tinyproxy.conf file contains example settings
## with explanations in comments. For decriptions of all
## parameters, see the tinproxy.conf(5) manual page.
##
#
# User/Group: This allows you to set the user and group that will be
@hzbd
hzbd / aliyun_speech_ss.py
Last active November 3, 2021 01:20
aliyun speech synthesis service demo. 阿里云语音合成服务演示
# -*- coding:utf-8 -*-
#
# Copyright (c) 2021 623 MIT
#
from urllib import parse
import logging
import os
import time
@hzbd
hzbd / kafkakit.py
Last active March 28, 2021 13:17
kafka python3 handler kit.(writer&reader&admin)
# -*- coding: utf-8 -*-
#
# Copyright (c) 2021 六二三
# Licensed under the MIT License.
# All rights reserved.
#
# Deps:
# pip3 install kafka-python==2.0.2
#
#
@hzbd
hzbd / dingtalkkit.py
Last active January 11, 2022 13:24
github action dingtalk bot
# -*- coding:utf-8 -*-
#
# Copyright (c) 2021 六二三
# Licensed under the MIT License.
# All rights reserved.
#
#---------------------------------+
# * PyEnv: Python3
# * Things to do before starting:
# 1.add action secrect `DINGTALK_ACCESS_TOKEN` & `DINGTALK_SECRET`.