This file contains hidden or 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
#!/bin/bash | |
if [ $# != 3 ]; then | |
echo "This script backup all of SVN repositories under the [svn root] directory, to the [backup root] directory." | |
echo "usage: svn-backup ['full'|'part'] [svn root] [backup root]" | |
echo "example: svn-backup full /opt/svn-repos /opt/svn-backup" | |
exit | |
fi | |
mode=$1 |
This file contains hidden or 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
QueryString = function(qs){ | |
this.p={}; | |
if(!qs) | |
qs=location.search; | |
if(qs) { | |
var b = qs.indexOf('?'); | |
var e = qs.indexOf('#'); |
This file contains hidden or 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
SimpleAjax = function(url, method, content){ | |
this.r = null; | |
this.url = url; | |
this.method = method; | |
this.content = content; | |
this.header = {}; | |
this.header["Connection"] = "close"; | |
this.header["Content-type"] = "application/x-www-form-urlencoded"; | |
var self = this; |
This file contains hidden or 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
function html_encode(str) { | |
var s = ""; | |
if (str.length == 0) return ""; | |
s = str.replace(/&/g, "&"); | |
s = s.replace(/</g, "<"); | |
s = s.replace(/>/g, ">"); | |
s = s.replace(/\'/g, "'"); | |
s = s.replace(/\"/g, """); | |
return s; | |
} |
This file contains hidden or 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 | |
class file_cache | |
{ | |
private $root_dir; | |
public function __construct($root_dir) { | |
$this->root_dir = $root_dir; | |
if (FALSE == file_exists($this->root_dir)) { | |
mkdir($this->root_dir, 0700, true); |
This file contains hidden or 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
-module(utf8_util). | |
-export([get_utf8_char/1]). | |
get_utf8_char ([]) -> | |
{0, []}; | |
get_utf8_char ([Char1 | String]) -> | |
get_utf8_char(Char1, String). | |
get_utf8_char (Char1, String) when Char1 < 16#80 -> | |
{Char1, String}; |
This file contains hidden or 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 | |
// | |
// Test whether the text is UTF-8 encoding | |
// | |
// Result: | |
// 1 - Has BOM head | |
// 2 - Pure UTF-8 context | |
// 3 - More likely to be UTF-8 content | |
// 4 - Less likely to be UTF-8 content | |
// |
This file contains hidden or 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 | |
// | |
// Get UTF-8 length of the text. | |
// Return false when the text not UTF-8 encoding. | |
// | |
function utf8_length($text) | |
{ | |
$text_len = strlen($text); | |
$utf8_len = 0; | |
This file contains hidden or 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
// | |
// How to set timeout for http.Get() in golang | |
// | |
package main | |
import ( | |
"io" | |
"io/ioutil" | |
"log" | |
"net" |
OlderNewer