This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A small SSH daemon providing bash sessions | |
// | |
// Server: | |
// cd my/new/dir/ | |
// #generate server keypair | |
// ssh-keygen -t rsa | |
// go get -v . | |
// go run sshd.go | |
// | |
// Client: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Gmail remove gstatic | |
// @namespace ockcyp/gmail-remove-gstatic | |
// @version 0.1 | |
// @description Remove gstatic from external image URLs (useful when URLs contain internal domains) | |
// @author ockcyp | |
// @grant none | |
// ==/UserScript== | |
setTimeout(function() { | |
// Page is loaded and the div is not already created |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* CIDR.php | |
* | |
* Utility Functions for IPv4 ip addresses. | |
* Supports PHP 5.3+ (32 & 64 bit) | |
* @author Jonavon Wilcox <jowilcox@vt.edu> | |
* @revision Carlos Guimarães <cvsguimaraes@gmail.com> | |
* @version Wed Mar 12 13:00:00 EDT 2014 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function convert_size_val($size){ | |
$unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb'); | |
return @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $unit[$i]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 高亮XML代码 | |
if ( ! function_exists('xml_highlight')) | |
{ | |
function xml_highlight($s) | |
{ | |
$s = htmlspecialchars($s); | |
$s = preg_replace("#<([/]*?)(.*)([\s]*?)>#sU", "<span style=\"color:#0000FF\"><\\1\\2\\3></span>",$s); | |
$s = preg_replace("#<([\?])(.*)([\?])>#sU", "<span style=\"color:#800000\"><\\1\\2\\3></span>",$s); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// 验证邮箱地址是否合法 | |
if ( ! function_exists('verify_email')) | |
{ | |
function verify_email($email) | |
{ | |
$regex = "/^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z0-9])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i"; | |
return preg_match($regex, $email) === 1; | |
} |