Skip to content

Instantly share code, notes, and snippets.

@undirectlookable
undirectlookable / nebula@.service
Created November 25, 2022 13:56
nebula serivce systemd script
[Unit]
Description=nebula for %i
Wants=basic.target
After=basic.target network.target
Before=sshd.service
[Service]
SyslogIdentifier=nebula(%i)
ExecReload=/bin/kill -HUP $MAINPID
ExecStart=/usr/local/bin/nebula -config /etc/nebula/%i.yml
@undirectlookable
undirectlookable / ttfb.sh
Created March 22, 2022 07:52
Get TTFB by curl
#!/bin/bash
# file: ttfb.sh
# curl command to check the time to first byte
# ** usage **
# 1. ./ttfb.sh "https://google.com"
# 2. seq 10 | xargs -Iz ./ttfb.sh "https://google.com"
curl -o /dev/null \
-H 'Cache-Control: no-cache' \
-s \
@undirectlookable
undirectlookable / china_route.win.bat
Created October 18, 2018 07:16
Change gateway for China IP address
route DELETE 0.0.0.0
route ADD 0.0.0.0 MASK 0.0.0.0 10.0.0.1
route ADD 1.1.8.0 MASK 255.255.255.0 192.168.168.168
route ADD 1.2.4.0 MASK 255.255.255.0 192.168.168.168
route ADD 1.8.18.0 MASK 255.255.255.0 192.168.168.168
route ADD 1.8.102.0 MASK 255.255.255.0 192.168.168.168
route ADD 1.8.108.0 MASK 255.255.255.0 192.168.168.168
route ADD 1.8.238.0 MASK 255.255.254.0 192.168.168.168
route ADD 1.24.0.0 MASK 255.248.0.0 192.168.168.168
route ADD 1.45.0.0 MASK 255.255.0.0 192.168.168.168
@undirectlookable
undirectlookable / airnow-aqi.html
Created March 21, 2018 10:37
AirNow.gov 24 hours AQI table
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>AQI (airnow data)</title>
<script>
var city = location.hash.substr(1) || 'Beijing'
const aqiCats = [
@undirectlookable
undirectlookable / README.md
Last active June 23, 2020 16:08
Subresource Integrity (SRI) Hash Generator
@undirectlookable
undirectlookable / qqvideo-html5.user.js
Created November 22, 2016 02:32
在 Windows 系统中使用 HTML5 版的腾讯视频播放器 (userscript)
// ==UserScript==
// @name QQVideo HTML5
// @namespace http://v.qq.com/
// @version 1.0
// @description 在 Windows 系统中使用 HTML5 版的腾讯视频播放器
// @author Anonymous
// @match *://v.qq.com/*
// @grant none
// @run-at document-start
// ==/UserScript==
@undirectlookable
undirectlookable / apkpure-dl.py
Created February 29, 2016 03:39
Download apk file from APKPure.com
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
__version__ = '1.0.0'
import re
import os
import sys
import argparse
import urllib
@undirectlookable
undirectlookable / nginx_static_to_dynamic_modules.zh-cn.md
Created February 17, 2016 08:37
[译] NGINX - 将静态模块转换为动态模块

NGINX - 将静态模块转换为动态模块

翻译信息 原文:https://www.nginx.com/resources/wiki/extending/converting/ 时间:2016年02月17日 译者:@Undirectlookable

NGINX 从 1.9.11 版本起,引入了一个新的模块加载方式:动态加载。这意味着模块可以根据配置文件,在 NGINX 运行时动态的加载。同样,也可以通过修改配置文件然后 Reload NGINX 来卸载模块。

模块API对于静态模块和动态模块是一致的,但是 config 文件和编译方法略微不同。这篇文章将解释这些变化。

@undirectlookable
undirectlookable / rpi-golang-install.sh
Last active April 19, 2016 12:25
Install Go Binaries on Raspberry Pi
#!/usr/bin/env bash
# Install Go Binaries on any ARMv6/ARMv7 system.
# Binaries from http://dave.cheney.net/unofficial-arm-tarballs
# Fetch release page and get latest tarball link
LINK=`wget -q -O - https://golang.org/dl/ | grep '\/go.*linux-armv6l\.tar\.gz' | head -1 | sed 's/^\(.*\)\(http[^">]*\)\(.*\)$/\2/'`
# Get Filename
FILENAME=`echo $LINK | sed 's/\(.*\)\(go.*linux-armv6l\.tar\.gz\)/\2/'`
@undirectlookable
undirectlookable / rpi-nodejs-install.sh
Last active December 10, 2020 22:12
Install Node.js Binaries on Raspberry Pi A/A+/B/B+ (ARMv6 CPU)
#!/usr/bin/env bash
# Install Node.js Binaries on Raspberry Pi A/A+/B/B+ (ARMv6 CPU).
# Get the latest Node.js Binaries filename
# Result like: node-v5.5.0-linux-armv6l.tar.gz
# For RPi2 Model B, replace "armv6l" with "armv7l".
FILENAME=`wget -q -O - https://nodejs.org/dist/latest/SHASUMS256.txt | grep linux-armv6l.tar.gz | sed 's/^[0-9a-f]\+\s*//g'`
# Download
if [ ! -f $FILENAME ]; then