Skip to content

Instantly share code, notes, and snippets.

View fortitudepub's full-sized avatar
💭
Enthusiast of networking and systems, happy hacking

dyz fortitudepub

💭
Enthusiast of networking and systems, happy hacking
View GitHub Profile
@fortitudepub
fortitudepub / LICENSE
Created October 25, 2024 04:08 — forked from amane-katagiri/LICENSE
Wiki.jsでPGroongaを用いて全文検索を行う(/wiki/server/modules/search/pgroonga あたりに配置)
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
@fortitudepub
fortitudepub / reply-to-empty-udp.py
Created March 8, 2024 03:11 — forked from jcwarp/reply-to-empty-udp.py
Simple Python UDP echo server
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: David Manouchehri <[email protected]>
# This script will always echo back data on the UDP port of your choice.
# Useful if you want nmap to report a UDP port as "open" instead of "open|filtered" on a standard scan.
# Works with both Python 2 & 3.
import socket
@fortitudepub
fortitudepub / gist:6d66c57cfaaa3fce933e473c55d5f68a
Created August 9, 2022 06:19
oneliner to dump ipset and sync to vpp
ipset list | tail -n +9 - | xargs -I X vppctl glx overlay route add table 1024 X/32 acc tunnel1 1
@fortitudepub
fortitudepub / gist:74c860329535ddfaf9a089c6bb107191
Created May 26, 2022 10:34
A simle dnsmasq status check and restart when needed because it might listen to tailscale IP.
#!/bin/bash
logger -t "dnsmasqlivecheck" "dnsmasq live check run"
if [[ ! -f /run/dnsmasq/dnsmasq.pid ]]; then
logger -t "dnsmasqlivecheck" "dnsmasq pid not present, restart"
systemctl restart dnsmasq
exit 1
fi
比如:
定义一个单链表,链表上一共有10个节点,每个节点是对应的数字编号(1到10),要求实现从链表尾部打印编号的程序,也即打出的结果是10到1。
要求:
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.13.1
restart: unless-stopped
hostname: NODE_NAME
ulimits:
memlock:
soft: -1
hard: -1
@fortitudepub
fortitudepub / shardcalc.py
Created June 24, 2021 11:47 — forked from colmmacc/shardcalc.py
Calculate the blast radius of a shuffle shard
import sys
# choose() is the same as computing the number of combinations. Normally this is
# equal to:
#
# factorial(N) / (factorial(m) * factorial(N - m))
#
# but this is very slow to run and requires a deep stack (without tail
# recursion).
#
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEAyANWv5g2/AyV28I+l4Tfk5tnCVdCJt6RMTjMPo7CO3cymvTS
a4IClFR7+ArdpcWHLaNBSZYBn7dOmGKwCdOO8y7/i3P83h4mc+y67BMPsKm7+TKs
Klck/Ssy7cm8mCUs9Y5OuMiX7FDWEf0uzRzwN3OXbb2pU3/iMeD6j48PgTwwVlEu
lgr21GwjvLlBU00iKDH8fwq7NYxLJdhuXc0sbkTEZZcA6kRwfSwq4Q9iY5DGeMkJ
TT1L53XCAax0yUCsX0K3I5vP33RJ/M9GxpWBKYohk6lnHtf4n/Nst+EN7XkL8baf
7g1zTwXkt9FrqJgmyBmCQ1gTKBbjGPy0v2TniwIDAQABAoIBAGlUoM17SpGHyy+U
5sOCfP9N2oAnzLWNhibGw4C6S31nc2X5QgrNx6/3oeVpS3puQJb/H3WyIp7KuQA1
EIHMQL6+ZGM7LNKITDXGWFXUX/HoIQ7F6bbOd7M/ma1yDPiOs1OJotlbAe64T1Pf
4lKwR6zcGcX4GIDZmvQrh6gsbbzfV1v/sVkSUJAWUXs5O7NMTj8UqMDZGx0bv9DX
@fortitudepub
fortitudepub / ddns.sh
Last active March 17, 2020 16:53 — forked from lyoshenka/ddns.sh
Quick and dirty DDNS using Bash and Cloudflare (API v4 compatible)
#!/usr/bin/env bash
# Step 1: Fill in EMAIL, TOKEN, DOMAIN and SUBDOMAIN. Your API token is here: https://www.cloudflare.com/a/account/my-account
# Make sure the token is the Global token, or has these permissions: #zone:read, #dns_record:read, #dns_records:edit
# Step 2: Create an A record on Cloudflare with the subdomain you chose
# Step 3: Run "./ddns.sh -l" to get the zone_id and rec_id of the record you created.
# Fill in ZONE_ID and REC_ID below
# This step is optional, but will save you 2 requests every time you this script
# Step 4: Run "./ddns.sh". It should tell you that record was updated or that it didn't need updating.
# Step 5: Run it every hour with cron. Use the '-s' flag to silence normal output
1. speedtest ssl cert verification issue (no local ca chain, thus need set this before make python https connection)
export PYTHONHTTPSVERIFY=0