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 / 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 / 00_make_city_geo.ipynb
Created December 24, 2020 15:51 — forked from junkor-1011/00_make_city_geo.ipynb
市区町村界、都道府県界データ作成
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@hzbd
hzbd / oss-upload.sh
Created December 19, 2020 05:54 — forked from jsoendermann/oss-upload.sh
阿里云 Aliyun OSS curl upload 上传
RESOURCE="/${OSS_BUCKET_NAME}/${OBJECT_NAME}"
CONTENT_MD5=$(openssl dgst -md5 -binary "${FILEPATH}" | openssl enc -base64)
CONTENT_TYPE=$(file -ib "${FILEPATH}" |awk -F ";" '{print $1}')
DATE_VALUE="`TZ=GMT date +'%a, %d %b %Y %H:%M:%S GMT'`"
STRING_TO_SIGN="PUT\n${CONTENT_MD5}\n${CONTENT_TYPE}\n${DATE_VALUE}\n${RESOURCE}"
SIGNATURE=$(echo -e -n $STRING_TO_SIGN | openssl dgst -sha1 -binary -hmac $OSS_ACCESS_KEY_SECRET | openssl enc -base64)
URL="http://${OSS_BUCKET_NAME}.${OSS_REGION}.aliyuncs.com/${OBJECT_NAME}"
curl -i -q -X PUT -T "${FILEPATH}" \
-H "Host: ${OSS_BUCKET_NAME}.${OSS_REGION}.aliyuncs.com" \
-H "Date: ${DATE_VALUE}" \
@hzbd
hzbd / Apache_APISIX_Consul
Created October 29, 2020 06:28 — forked from moonming/Apache_APISIX_Consul
How to use Consul as Registration Center in Apache APISIX?
## Install Consul
1. download consul
```
wget https://releases.hashicorp.com/consul/1.7.3/consul_1.7.3_linux_amd64.zip
```
2. unzip to `/usr/bin`
```
sudo unzip consul_1.7.3_linux_amd64.zip -d /usr/bin
@hzbd
hzbd / auto_cmd.py
Created October 19, 2020 05:08 — forked from himanshurawlani/auto_cmd.py
Script to automate starting and stopping of Flask and TF_Serving servers
import os
import signal
import subprocess
# Making sure to use virtual environment libraries
activate_this = "/home/ubuntu/tensorflow/bin/activate_this.py"
exec(open(activate_this).read(), dict(__file__=activate_this))
# Change directory to where your Flask's app.py is present
os.chdir("/home/ubuntu/Desktop/Medium/keras-and-tensorflow-serving/flask_server")
@hzbd
hzbd / db-setup.sql
Created August 16, 2020 10:13 — forked from gka/db-setup.sql
load geoip database into mysql
DROP TABLE IF EXISTS location;
CREATE TABLE IF NOT EXISTS `location` (
`locId` int(11) unsigned NOT NULL AUTO_INCREMENT,
`country` varchar(2) DEFAULT NULL,
`region` varchar(2) DEFAULT NULL,
`city` varchar(1000) DEFAULT NULL,
`postalCode` varchar(10) DEFAULT NULL,
`latitude` float DEFAULT NULL,
`longitude` float DEFAULT NULL,
@hzbd
hzbd / subnet.py
Created November 3, 2019 14:10 — forked from vndmtrx/subnet.py
Python 3 simple subnet calculator
#!/usr/bin/env python3
# Use: ./subnet.py <ip/cidr>
# Alt: ./subnet.py <ip> <mask>
import sys
if __name__=="__main__":
addr = [0, 0, 0, 0]
mask = [0, 0, 0, 0]
cidr = 0