Skip to content

Instantly share code, notes, and snippets.

@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 / download.php
Last active December 15, 2015 20:09 — forked from chengyuhui/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 / 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