Skip to content

Instantly share code, notes, and snippets.

# encoding: utf-8
#
# Author: Erick Guan <fantasticfears@gmail.com>
#
# This script import the data from latest Discuz! X
# Should work among Discuz! X3.x
# This script is tested only on Simplified Chinese Discuz! X instances
# If you want to import data other than Simplified Chinese, email me.
require 'php_serialize'
@zh99998
zh99998 / aggregate-cidr-addresses.pl
Last active September 17, 2015 08:53 — forked from denji/README.md
Take a list of CIDR address blocks and combine them, for example, 192.168.0.0/24 and 192.168.1.0/24 gives 192.168.0.0/23. I usually use "list-iana-reserved-ranges | aggregate-cidr-addresses" to get a list of blocks to not report with firewall log processing.
#!/usr/bin/perl
#
# aggregate-cidr-addresses - combine a list of CIDR address blocks
# Copyright (C) 2001,2007 Mark Suter <suter@zwitterion.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
@zh99998
zh99998 / smokeping.psgi
Last active September 16, 2015 07:46 — forked from dne/smokeping.psgi
Smokeping PSGI app
#!/usr/bin/perl
use strict;
use warnings;
use CGI::Emulate::PSGI;
my $app = CGI::Emulate::PSGI->handler(sub {
use CGI;
use Smokeping;
CGI::initialize_globals();
@zh99998
zh99998 / maotama.rb
Last active August 29, 2015 13:57
maotama for rpg maker
module Maotama
Achievements = [
21..28
]
def self.unlock_achievement(type, id)
STDOUT.write("<maotama><achievement type='#{type}' id='#{id}'/></maotama>")
STDOUT.flush
end
end
@zh99998
zh99998 / download.php
Last active December 15, 2015 20:09 — forked from kmod-midori/download.php
downloads for mycard
<?php
function detect() {
$userAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
// Identify the browser. Check Opera and Safari first in case of spoof. Let Google Chrome be identified as Safari.
if (preg_match('/opera/', $userAgent)) {
$name = 'opera';
}
elseif (preg_match('/webkit/', $userAgent)) {
$name = 'safari';
@zh99998
zh99998 / ucenter-wrapper.php
Last active December 14, 2015 22:49
Work-around api for ucenter. Across the php we can reach every corner in the world!
<?php
include './config.inc.php';
include './uc_client/client.php';
$function = 'uc_'.$_REQUEST['action'];
if(function_exists($function)){
$paramters = json_decode($_REQUEST['paramters']);
if(UC_CHARSET != 'UTF-8'){
foreach($paramters as $index => $paramter){
if(is_string($paramter)){
@zh99998
zh99998 / mycard.nginxconf
Last active December 12, 2015 03:58
mycard-web-front
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
@zh99998
zh99998 / gplus.quick_mention.user.js
Created September 30, 2012 10:22 — forked from quietlynn/gplus.quick_mention.user.js
Google+ Quick Mention => Mention G+ users quickly.
/*
Google+ Quick Mention => Mention G+ users quickly.
Copyright (C) 2012 Jingqin Lynn
Includes jQuery
Copyright 2011, John Resig
Dual licensed under the MIT or GPL Version 2 licenses.
http://jquery.org/license
Includes Sizzle.js