Skip to content

Instantly share code, notes, and snippets.

View ZE3kr's full-sized avatar
🎯
Focusing

James Guo ZE3kr

🎯
Focusing
View GitHub Profile
@ZE3kr
ZE3kr / index.php
Last active August 29, 2015 14:24
Read and formatting the EXIF data from UPYUN and generate a JavaScript code. Support GPS data and use Mapbox. (Used in https://ze3kr.tlo.xyz and can across domain)
<?
$mmc = memcache_init();
/**
* 将分数转化为浮点数
**/
function Deci_Con($coordPart){
$parts = explode('/', $coordPart);// 将 "/" 的两边数据转化为数组
if (count($parts) <= 0)
@ZE3kr
ZE3kr / README.md
Last active September 3, 2016 14:39
WoSign GitHub.io
@ZE3kr
ZE3kr / theme.js
Last active November 13, 2016 00:53 — forked from jessor/theme.js
Track Wordpress Comments as Piwik Goals with jQuery
jQuery.noConflict();
jQuery(document).ready(function($) {
// ...
$('#commentform').submit(function() {
_paq.push(['trackGoal', '1']); // logs a conversion for goal 1
});
// ...
});
@ZE3kr
ZE3kr / en.php
Last active January 29, 2017 10:58
Add Reply Notify via Email on WordPress, no configuration is needed. 中文介绍:https://ze3kr.com/2016/08/back-to-wordpress-builtin-comment-system/
<?php
function tlo_comment_mail_notify($comment_id) {
global $comment_author;
$comment = get_comment($comment_id);
$parent_id = $comment->comment_parent ? $comment->comment_parent : '';
$spam_confirmed = $comment->comment_approved;
$from = $comment->comment_author_email;
$to = get_comment($parent_id)->comment_author_email;
if (($parent_id != '') && ($spam_confirmed != 'spam') && $from != $to && $to != get_bloginfo('admin_email') ) {
$blog_name = get_option('blogname');
@ZE3kr
ZE3kr / ddns.sh
Created February 25, 2017 00:07
DDNS.sh for Rage4, Hurricane Electric DNS and Hurricane Electric Tunnel Broker
#!/bin/sh
# A simple DDNS tool written in shell, support Rage4, Hurricane Electric DNS and Hurricane Electric Tunnel Broker.
# @version 0.1.2
# Global Settings, set to ture to enable
use_ipv4=false;
use_ipv6=false;
logfile="/var/log/ddns.log"; # Set it to "/dev/null" to disable log.
get_ip_service="http://api.tlo.xyz:8081/myip/ip.php"; # Need to support IPv4 and IPv6
@ZE3kr
ZE3kr / wordpress-super-cache.conf
Last active June 30, 2017 09:07
Can be used for WP Super Cache plugin. You need to configure WP Super Cache to "Use PHP to serve cache files.", and turned ON "Don’t cache pages with GET parameters.", turned OFF "Compress pages so they’re served more quickly to visitors.".
# WP Super Cache rules.
# Designed to be included from a 'wordpress-ms-...' configuration file.
set $cache_uri $uri;
# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
set $cache_uri 'null cache';
}
@ZE3kr
ZE3kr / IP Service for Cloudflare Worker.js
Last active January 2, 2020 23:08
Demo: https://api.tloxygen.com/ip (Use Cloudflare by default, UPYUN for China) or http://api.tloxygen.net/ip (Only use Cloudflare)
addEventListener('fetch', event => {
event.respondWith(fetchAndApply(event.request))
})
async function fetchAndApply(request) {
if(request.url === 'https://api.tloxygen.com/ip' || request.url === 'http://api.tloxygen.com/ip') {
const ip = request.headers.get('cf-connecting-ip')
return new Response(ip)
} else if (request.url === 'https://api.tloxygen.com/country' || request.url === 'http://api.tloxygen.com/country') {
const ip = request.headers.get('cf-ipcountry')
#!/bin/bash
for (( ; ; )); do
mv new.json old.json 2> /dev/null
curl 'https://www.ems.com.cn/apple/getMailNoRoutes' --data-raw 'mailNum=EZ690XXXXXXCN' -s > new.json
DIFF_OUTPUT="$(diff new.json old.json)"
if [ "0" != "${#DIFF_OUTPUT}" ]; then
# Send notification here
echo "CHANGED"
fi
@ZE3kr
ZE3kr / apple.sh
Last active November 13, 2021 09:18
苹果官网发货状态检测
#!/bin/bash
for (( ; ; )); do
mv new.txt old.txt 2> /dev/null
curl "https://www.apple.com.cn/xc/cn/vieworder/W123456789/name@example.com" -s -L | grep "currentStatus" | jq '.orderDetail.orderItems."orderItem-0000101".orderItemStatusTracker.d.currentStatus' > new.txt
DIFF_OUTPUT="$(diff new.txt old.txt)"
if [ "0" != "${#DIFF_OUTPUT}" ]; then
// DO SOMETHING HERE
fi
sleep 300
@ZE3kr
ZE3kr / youtube_premium_check.js
Created December 6, 2021 11:46 — forked from Hyseen/youtube_premium_check.js
YouTube Premium 解锁检测模块
/**
*
* [Panel]
* youtube_premium_check = script-name=youtube_premium_check, title="YouTube Premium 解锁检测", update-interval=1
*
* [Script]
* youtube_premium_check = type=generic, script-path=https://gist.githubusercontent.com/Hyseen/5ae36a6a5cb5690b1f2bff4aa19c766f/raw/youtube_premium_check.js?version=1633074636264, argument=title=YouTube 解锁检测
*
* 支持使用脚本使用 argument 参数自定义配置,如:argument=key1=URLEncode(value1)&key2=URLEncode(value2),具体参数如下所示,
* title: 面板标题