Skip to content

Instantly share code, notes, and snippets.

View chawyehsu's full-sized avatar
☯️
no silver bullet

Chawye Hsu chawyehsu

☯️
no silver bullet
View GitHub Profile
@chawyehsu
chawyehsu / fapi.php
Last active August 29, 2015 14:08
[API] Get favcion of a site.
<?php
$url = @$_GET['url'];
if($url) {
$url = preg_replace('/http\:\/\//i', '', $url);
$url = 'http://' . $url;
$domain = parse_url($url);
$url = $domain['host'];
$dir = 'fcache';
$dfav = $dir . "/default.ico";
$fav = $dir . "/" . $url . ".ico";
@chawyehsu
chawyehsu / messages.yml
Created December 22, 2014 09:05
Simplified Chinese translation of "SimpleAuth", a plugin of PocketMine-MP, the Minecraft PE server software.
# SimpleAuth 1.4.0 language file
join:
message: "本服使用了SimpleAuth进行身份验证。"
register: "您尚未注册。\n注册指令: /register <password>"
login: "登录指令: /login <password>"
register:
usage: "/register <password>"
description: "注册指令"
@chawyehsu
chawyehsu / zh_CN.yml
Last active August 29, 2015 14:20
[Version 1.3]: Simplified Chinese translation of "UHPlugin" (https://github.com/AmauryCarrade/UHPlugin), a plugin for Minecraft server, creating uhc game.
author: "h404bi"
keys:
load:
spawnPointAdded: "预设出生点 {0},{1} 已从配置文件载入"
invalidSpawnPoint: "配置文件预设的出生点无效: {0}"
teamAdded: "预设队伍 {0} 已从配置文件载入"
namedTeamAdded: "预设队伍 {0} ({1}) 已从配置文件加入"
invalidTeam: "配置文件预设的队伍无效: {0}"
recipeApple: "已增加新的金苹果合成配方"
recipeCompass: "已增加新的指南针合成配方"
@chawyehsu
chawyehsu / VeinMiner_zh_CN.lang
Last active August 22, 2016 08:38
⚠️ 该版本已过时,前往 https://goo.gl/vTS24U 获取最新翻译文件。- Simplified Chinese translation of "VeinMiner" mod.
# Command usage/error
command.veinminer=/veinminer mode/blocklist/toollist/blocklimit/radius/per_tick/saveconfig/help
command.veinminer.enable=/veinminer mode auto/sneak/no_sneak
command.veinminer.blocklist=/veinminer blocklist %s add/remove <模组 id>:<方块名> <metadata>
command.veinminer.toollist=/veinminer toollist %s add/remove <工具 id>
# Command result/Mode status
command.veinminer.set.disable=已禁用 Veinminer
command.veinminer.set.auto=已设置 Veinminer 为热键模式
command.veinminer.set.sneak=已设置 Veinminer 为潜行模式
From: Wesley Wolfe <email redacted>
Date: 3 September 2014 03:48
Subject: [SL] [abuse-google] Copyright
My name is Wesley Wolfe. A site hosted on an IP address owned by Multiplay
(ip redacted) is infringing on my software copyright by the distribution
of a software known as CraftBukkit.
Original content can be found at
@chawyehsu
chawyehsu / hook.py
Created September 24, 2015 06:04
GitHub pages Webhook
#!/usr/bin/env python3
#-*- coding:utf-8 -*-
# start a python service and watch the nginx request dog
from http.server import HTTPServer, CGIHTTPRequestHandler
from threading import Thread, RLock
from hashlib import sha1
import ipaddress
import subprocess
import requests
@chawyehsu
chawyehsu / index.html
Created August 20, 2017 15:59
思源字体网页 font-family 指定 test case(仅简中)
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>思源字体网页 font-family 指定 test case(仅简中)</title>
<style>
body {
font-family: simsun,serif;
font-weight: normal;
}
@chawyehsu
chawyehsu / soft-line-breaks-reference.txt
Last active July 15, 2018 09:34
About CJK soft-line-breaks
https://talk.commonmark.org/t/soft-line-breaks-should-not-introduce-spaces/285
https://github.com/markdown-it/markdown-it/issues/334
http://chenyufei.info/blog/2011-12-23/fix-chinese-newline-becomes-space-in-browser-problem/
https://stackoverflow.com/questions/8550112/prevent-browser-converting-n-between-lines-into-space-for-chinese-characters/8551033#8551033
http://blog.guorongfei.com/2015/04/25/how-to-fix-the-markdown-newline-blank-problem/
https://9.obelus.net/2018/04/15/cjk-markdown-whitespace-and-newline.html
https://www.v2ex.com/t/69433
@chawyehsu
chawyehsu / CleanSubtitleFile.py
Last active July 28, 2018 06:22
自用小脚本:对从ch9下载的字幕文件进行自动化整理,去除无用行方便导入Aegisub
import os, glob
keys = [
"WEBVTT",
"-->"
]
def hasKey(array, line):
for item in array:
if item in line:
@chawyehsu
chawyehsu / pQuery.js
Created August 20, 2018 12:34 — forked from niyazpk/pQuery.js
Add or update query string parameter
// Add / Update a key-value pair in the URL query parameters
function updateUrlParameter(uri, key, value) {
// remove the hash part before operating on the uri
var i = uri.indexOf('#');
var hash = i === -1 ? '' : uri.substr(i);
uri = i === -1 ? uri : uri.substr(0, i);
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
var separator = uri.indexOf('?') !== -1 ? "&" : "?";
if (uri.match(re)) {