Skip to content

Instantly share code, notes, and snippets.

View breakertt's full-sized avatar
🐧
Exploring Linux Kernel!

Tianyi Gao breakertt

🐧
Exploring Linux Kernel!
  • School of Informatics, University of Edinburgh
  • Edinburgh, UK
  • 08:11 (UTC)
View GitHub Profile
@breakertt
breakertt / network-restart.sh
Created January 18, 2026 17:09 — forked from tachang/network-restart.sh
Cleanly restart the default libvirt network
#!/bin/bash
#
# Yury V. Zaytsev <yury@shurup.com> (C) 2011
#
# This work is herewith placed in public domain.
#
# Use this script to cleanly restart the default libvirt network after its
# definition have been changed (e.g. added new static MAC+IP mappings) in order
# for the changes to take effect. Restarting the network alone, however, causes
# the guests to lose connectivity with the host until their network interfaces
#!/bin/sh
### Run one line below to install and run
# curl -o /etc/init.d/S98port80guard https://gist.githubusercontent.com/breakertt/622a416cc4202218194b9e28f27c7e66/raw/b43ab8d786dc8b8f7e597b3065a0bb339e5c8981/S98port80guard && chmod +x /etc/init.d/S98port80guard && /etc/init.d/S98port80guard start
### BEGIN INIT INFO
# Provides: port_guard_80
# Required-Start: $network
# Default-Start: S
# Default-Stop:
import subprocess
import time
# Replace with your SSH host, username, and command
host = '127.0.0.1'
user = 'breakertt'
response_size = 8192
command = """awk 'BEGIN {{while (c++<%d) printf "?"; print "ACK"}}'""" % response_size
#command = """awk "BEGIN {{while (c++<%d) printf '?'; print 'ACK'}}"\n""" % (response_size)
@breakertt
breakertt / plex.nginx.conf
Created August 26, 2024 15:22 — forked from ometa/plex.nginx.conf
NGINX reverse proxy in front of Plex media server v1.3.3.3148
# This example assumes the NGINX proxy is on the same host as the Plex Media Server.
# To configure Plex Media Server to serve requests without requiring authentication,
# ensure that your LAN subnet is correctly added to the advanced server setting called
# "List of IP addresses and networks that are allowed without auth". Example:
# 192.168.0.1/24
upstream plex-upstream {
server 127.0.0.1:32400;
}
@breakertt
breakertt / datastructure.md
Created August 26, 2024 00:04 — forked from BruceChen7/datastructure.md
[#networking]#networking

如何学习网络协议栈

工具

  • systemtap 几乎无所不能,可以在内核放置探测点,然后执行自己的代码。
  • kprobe:简单的工具,可以快速检验某个函数是否被执行到
  • packetdrill:用于验证 TCP 协议的行为很有用。

数据结构

@breakertt
breakertt / mikrotik-dynv6.rsc
Last active August 25, 2024 03:26
Mikrotik script to update record for dynv6
# !!!!!!! Minimal Mikrotik Vesrion 7.14 !!!!!!!!!
#
# Get DNS zone id and record id
# curl \
# -H "Authorization: Bearer {HTTP_TOKEN}" \
# -H "Accept: application/json" \
# https://dynv6.com/api/v2/zones
# curl \
# -H "Authorization: Bearer {HTTP_TOKEN}" \
# -H "Accept: application/json" \
@breakertt
breakertt / doh
Created August 24, 2024 19:50 — forked from M0r13n/doh
Setup Cloudflare as a DoH (DNS over HTTPS) resolver on Mikrotik devices (RouterOS v7.0.2+)
# Temporarily add a normal upstream DNS resolver
/ip dns set servers=1.1.1.1,1.0.0.1
# CA certificates extracted from Mozilla
/tool fetch url=https://curl.se/ca/cacert.pem
# Import the downloaded ca-store (127 certificates)
/certificate import file-name=cacert.pem passphrase=""
# Set the DoH resolver to cloudflare
@breakertt
breakertt / ubuntu_update_booting_kernel.md
Created August 19, 2024 16:24 — forked from chaiyujin/ubuntu_update_booting_kernel.md
Ubuntu: Install Kernel and Set GRUB Default Kernel

Ubuntu: Install Kernel and Set GRUB Default Kernel

Install Kernel

Install the default kernel:

sudo apt install linux-generic

Set GRUB Default Kernel

  1. Find entrance from /boot/grub/grub.cfg
    • Get the $menuentry_id_option:
@breakertt
breakertt / UDP-over-Socks5.md
Last active August 16, 2024 13:04
Test UDP over Socks5

I realize that there seems no easy to use tool to test UDP over Socks5, so I wrote a simpile client server pair on Python. Only requirement is pysocks.

Please change server ip and port in both python files before use.

udp-socks-client.py

import socket
import socks
const uptimerobot_id = 'your uptimerobot_id'
const upstream = 'stats.uptimerobot.com'
const upstream_path = '/' + uptimerobot_id
const replace_dict = {
'$upstream': '$custom_domain',