Skip to content

Instantly share code, notes, and snippets.

Avatar
I may be slow to respond.

hzbd

I may be slow to respond.
View GitHub Profile
@hzbd
hzbd / delete_action_runs.py
Created Jan 7, 2022 — forked from ferstar/delete_action_runs.py
Delete all workflow runs&artifacts of a github repo
View delete_action_runs.py
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 Dec 8, 2021 — forked from kekru/01nginx-tls-sni.md
nginx TLS SNI routing, based on subdomain pattern
View 01nginx-tls-sni.md

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 Nov 21, 2021
git lazy bash demo.
View gitlazy.sh
#!/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 Nov 20, 2021
rust reqwest demo with headers
View reqwest_demo.rs
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 Nov 5, 2021
fake user info for jq demo parser.
View fake_userinfo.json
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,
View tinyproxy.conf
##
## 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 Nov 3, 2021
aliyun speech synthesis service demo. 阿里云语音合成服务演示
View aliyun_speech_ss.py
# -*- coding:utf-8 -*-
#
# Copyright (c) 2021 623 MIT
#
from urllib import parse
import logging
import os
import time
@hzbd
hzbd / kafkakit.py
Last active Mar 28, 2021
kafka python3 handler kit.(writer&reader&admin)
View kafkakit.py
# -*- 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 Jan 11, 2022
github action dingtalk bot
View dingtalkkit.py
# -*- 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 Dec 24, 2020 — forked from junkor-1011/00_make_city_geo.ipynb
市区町村界、都道府県界データ作成
View 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.