Skip to content

Instantly share code, notes, and snippets.

View moesoha's full-sized avatar
🧐
Busy working

Soha Jin moesoha

🧐
Busy working
View GitHub Profile
@moesoha
moesoha / generate_ptp_cost.sh
Last active March 17, 2023 18:04
Generate BIRD constants with ping statistics in 10s
#!/bin/sh
# gathering all interfaces with IPv6 link-local address
for with_ll in $(cat /proc/net/if_inet6 | grep "^fe80" | tr -s ' ' | cut -d ' ' -f 6 | sort -u); do
# POINTOPOINT flag is 1 << 4, filter non-PTP interfaces out
if [ $(expr \( $(($(cat /sys/class/net/$with_ll/flags))) / 16 \) % 2) -ne 1 ]; then
continue
fi
cost=65535
ping_rtt=N/A
@moesoha
moesoha / ip-ns
Last active February 18, 2021 08:37
`ip` in `iproute2` wrapper for `ifupdown`
#!/bin/sh
set -e
if [ -n "$IF_NETNS" ]; then
if [ "$1" = "exec" ]; then
shift 1
ip netns exec "$IF_NETNS" $@
else
ip -n "$IF_NETNS" $@
@moesoha
moesoha / update-ddns.slax
Created July 15, 2022 04:36
Juniper DDNS script
version 1.0;
ns junos = "http://xml.juniper.net/junos/*/junos";
ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";
ns curl extension = "http://xml.libslax.org/curl";
import "../import/junos.xsl";
/*
put this file as /var/db/scripts/op/update-ddns.slax
and then configure:
system {
@moesoha
moesoha / BLINK.ASM
Last active December 10, 2023 08:38
Enable/Disable hardware blinking provided by text mode on CGA/EGA/VGA cards
@moesoha
moesoha / get-unsubscribe.py
Created July 8, 2024 15:08
get unsubscribe method from raw email
import sys
import re
import urllib.parse
def get_unsubscribe_methods(eml_path):
unsubscribe = None
with open(eml_path, encoding='ascii', errors='ignore') as f:
for line in f:
if not line.strip():