Skip to content

Instantly share code, notes, and snippets.

View johnroyer's full-sized avatar

Zero Huang johnroyer

View GitHub Profile
@johnroyer
johnroyer / gist:c41dd6030065a274376fcc16af5a8722
Created April 28, 2025 09:52
Nginx config example for blocking bots
server {
if ($http_user_agent ~* (mj12bot|ahrefs|imagesift|BLEXBot|webmeup|toutiao|semrush|petalsearch|dataforseo)) {
return 402;
}
}
@johnroyer
johnroyer / tempermonkey-script.js
Created March 23, 2025 10:17
Remove YouTube video on the top of NewsTalk
// ==UserScript==
// @name Remove YouTube video on the top of NewsTalk
// @namespace https://newtalk.tw/
// @version 0.1
// @description remove the ads on the top
// @author zeroplex
// @match https://newtalk.tw/news*
// @run-at document-end
// @grant none
// ==/UserScript==
@johnroyer
johnroyer / forgejo-workflow.yaml
Created January 11, 2025 06:11
Forgejo Runner config
on: [push]
jobs:
"check PHP PSR":
runs-on: ubuntu-22.04
steps:
- name: "check out source code"
uses: "https://code.forgejo.org/actions/checkout@v4"
- name: "setup PHP"
uses: "shivammathur/[email protected]"
@johnroyer
johnroyer / docker-compose.yaml
Last active January 2, 2025 13:31
AdGuard docker-compose.yaml
# BUGGY
# This make docker host resolvd failed
# see: https://github.com/angristan/wireguard-install/issues/458
services:
adguard:
image: adguard/adguardhome:latest
restart: unless-stopped
volumes:
- ./data/work:/opt/adguardhome/work
- ./data/conf:/opt/adguardhome/conf
@johnroyer
johnroyer / gist:a9cb071e9c4bd2a84567a1f4688cb7b8
Created August 13, 2024 05:24
hide medium pricing banner
// ==UserScript==
// @name hide medium pricing banner
// @namespace http://tampermonkey.net/
// @version 2024-08-13
// @description try to take over the world!
// @author You
// @match https://*.medium.com/
// @grant none
// ==/UserScript==
@johnroyer
johnroyer / main.go
Created June 3, 2024 04:23
使用 os.Read() 讀取檔案遇到的讀取速度問題
package main
import (
"io"
"os"
)
func main() {
// 1 MB
bufferSize := 1 * 1024 * 1024
/path/to/ubuntu/pool/universe/g$ dust -d 1 -w 40 -r | tee
374G └─┬ .
45G ├── gcc-10-cross
23G ├── gcc-13-cross-ports
22G ├── gcc-13-cross
15G ├── gcc-10-cross-ports
14G ├── gcc-14-cross-ports
14G ├── gcc-14-cross
12G ├── gcc-11-cross
12G ├── gcc-12-cross-ports
@johnroyer
johnroyer / package.log
Last active April 28, 2024 03:43
ubuntu packages
apt-transport-https ca-certificates gnupg curl nano
vim-nox exuberant-ctags
net-tools fail2ban
aptitude
# Ubuntu Pro
sudo pro attach TOKEN
Feb 4 17:50:51 Zero-Lab-Router-F062F20-C WAN Connection: Fail to connect with some issues.
Feb 4 17:51:01 Zero-Lab-Router-F062F20-C WAN Connection: WAN was restored.
Feb 4 17:51:27 Zero-Lab-Router-F062F20-C WAN Connection: Fail to connect with some issues.
Feb 4 17:51:27 Zero-Lab-Router-F062F20-C WAN Connection: WAN was restored.
Feb 4 17:52:13 Zero-Lab-Router-F062F20-C WAN Connection: Fail to connect with some issues.
Feb 4 17:52:30 Zero-Lab-Router-F062F20-C WAN Connection: WAN was restored.
Feb 4 17:53:50 Zero-Lab-Router-F062F20-C WAN Connection: Fail to connect with some issues.
Feb 4 17:53:51 Zero-Lab-Router-F062F20-C WAN Connection: WAN was restored.
Feb 4 17:54:55 Zero-Lab-Router-F062F20-C WAN Connection: Fail to connect with some issues.
Feb 4 17:54:55 Zero-Lab-Router-F062F20-C WAN Connection: WAN was restored.
@johnroyer
johnroyer / deploy.yaml
Last active December 8, 2023 05:06
k8s deployment 格式
- name: phpfpm
image: php:8.1-alpine
imagePullPolicy: IfNotPresent
ports:
- containerPort: 9000
lifecycle:
postStart:
exec:
command:
- "/bin/sh"