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
#! /bin/bash | |
#设置console的颜色 | |
TPUT=/usr/bin/tput | |
RED=`$TPUT setaf 1` | |
GREEN=`$TPUT setaf 2` | |
YELLOW=`$TPUT setaf 3` | |
NORM=`$TPUT op` | |
HOSTFILE=~/.sshhosts | |
#输出红色文字,错误提示用 |
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 | |
//将内容进行UNICODE编码 | |
function unicode_encode($name) | |
{ | |
$name = iconv('UTF-8', 'UCS-2', $name); | |
$len = strlen($name); | |
$str = ''; | |
for ($i = 0; $i < $len - 1; $i = $i + 2) | |
{ |
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 strToHex($string) | |
{ | |
$hex=""; | |
for ($i=0;$i<strlen($string);$i++) | |
$hex.=dechex(ord($string[$i])); | |
$hex=strtoupper($hex); | |
return $hex; | |
} | |
function hexToStr($hex) |
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
#!/bin/bash | |
#param 1: the name of the configuration | |
#param 2: the path to backup | |
back_dir_prefix="/home/x/back/" | |
back_up(){ | |
name=$1 | |
path=$2 | |
echo $name " => " $path | |
last_back_dir="${back_dir_prefix}${name}" |
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
#!/bin/bash | |
# check daemon | |
check(){ | |
cmd=$1 | |
lines=`ps -ef | grep $cmd |grep -v grep |wc -l` | |
# if not found - equals to 1, start it | |
echo $lines | |
if [ $? -eq 0 ]; then | |
$cmd | |
else |
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
#! /bin/bash | |
#设置console的颜色 | |
TPUT=/usr/bin/tput | |
RED=`$TPUT setaf 1` | |
GREEN=`$TPUT setaf 2` | |
YELLOW=`$TPUT setaf 3` | |
NORM=`$TPUT op` | |
HOSTFILE=~/.sshhosts | |
#输出红色文字,错误提示用 |
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 | |
register_shutdown_function('handleShutdown'); | |
function handleShutdown() { | |
$error = error_get_last(); | |
if($error !== NULL){ | |
$info = "[SHUTDOWN] file:".$error['file']." | ln:".$error['line']." | msg:".$error['message'] .PHP_EOL; | |
$sapi_type = php_sapi_name(); | |
$sapi = substr($sapi_type, 0, 3); | |
if($sapi=="cli"){ | |
$info .= join(" ",$_SERVER["argv"]); |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
#导入smtplib和MIMEText | |
import smtplib | |
from email.mime.text import MIMEText | |
############# | |
#要发给谁,这里发给2个人 | |
##################### | |
#设置服务器,用户名、口令以及邮箱的后缀 | |
mail_host="smtp.****.com" |
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 | |
/** | |
* 遍历某个目录或某个目录用; | |
* 只需设置回调即可; | |
* */ | |
class Walker{ | |
var $dir; | |
var $callback=null; | |
var $num = 0; | |
var $ecode=0; |
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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<title>Creating OS notifications in HTML5</title> | |
</head> | |
<body> | |
<form> | |
<input type="button" value="Hey, do you want to show notifications or not?" onclick="init();" /> | |
<input type="button" value="Send OS notification" onclick="notify();" /> |
OlderNewer