Skip to content

Instantly share code, notes, and snippets.

View 186526's full-sized avatar
😇

Bo Xu 186526

😇
View GitHub Profile
@186526
186526 / app.js
Last active September 24, 2021 14:54
sw2express Custom Default Page, Like https://sw2express-custompage.186526.workers.dev/${statusCode}
import sw2express from "sw2express";
import * as customPage from "./sw2express.customDefaultPage.js";
const app = new sw2express();
app.extend(customPage.default);
app.use(async(req,rep)=>{
const statusCode = req.path.replace("/", "");
if (!isNaN(statusCode) && customPage.codeAlternative[statusCode] !== undefined) {
console.log(statusCode);
await customPage.getPage({
statusCode: statusCode,
@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