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 / 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 February 24, 2024 21:16
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,
@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`.
@hzbd
hzbd / 00_make_city_geo.ipynb
Created December 24, 2020 15:51 — forked from junkor-1011/00_make_city_geo.ipynb
市区町村界、都道府県界データ作成
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.