Skip to content

Instantly share code, notes, and snippets.

View johnroyer's full-sized avatar

Zero Huang johnroyer

View GitHub Profile
@johnroyer
johnroyer / mediawiki-mobile-redirect.js
Last active July 4, 2022 11:26
Redirect Mediawiki mobile page to general page
// ==UserScript==
// @name Redirect Mobile Mediawiki to Desktop URL
// @namespace http://blog.zeroplex.tw/
// @version 0.1
// @description If Mediawiki opened in mobile page, redirect it to general page
// @author zeroplex
// @match https://*.m.wikipedia.org/*
// @grant none
// ==/UserScript==
@johnroyer
johnroyer / query.php
Last active September 22, 2023 06:24
whois query using TCP socket in PHP
<?php
error_reporting(E_ALL);
echo "connection to whois.twnic.net.tw\n";
$address = gethostbyname('whois.iana.org.');
$fp = @fsockopen($address, 43, $errno, $errstr, 5) or die("Socket Error " . $errno . " - " . $errstr);
stream_set_blocking($fp, true);
@johnroyer
johnroyer / dl.sh
Created November 24, 2023 07:52
script for download youtube video via yt-dlp
#!/usr/bin/env bash
# Usage:
# dl.sh "https://www.youtube.com/watch?v=ec-IgIkEkmA"
#
# 限制檔案名稱長度,主要是為了避開 FAT、NTFS 的限制
/path/to/yt-dlp/yt-dlp.sh \
-o '%(title).150s-%(id)s.%(ext)s' \
-f "bestvideo[height<=1080][ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" \
@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"
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 / 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
/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