Skip to content

Instantly share code, notes, and snippets.

tomheng tomheng

Block or report user

Report or block tomheng

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View 关于 PAC 的书签夹.md
@tomheng
tomheng / gist:7600651
Last active Dec 29, 2015
简单的日志监控程序
View gist:7600651
#!/bin/sh
sleep 5m
log=/var/log/php5.log
tail -Fn0 $log | \
while read line; do
echo $line | grep 'Fatal error'
if [ $? = 0 ]
then
pids=$(ps aux | grep $0 | grep -v 'grep' | awk '{print $2}')
php mail_error.php 'PHP Fatal error' "$line" # do what you want to do
@tomheng
tomheng / gist:6149779
Last active May 21, 2019
用Memcache实现分布式的锁服务
View gist:6149779
<?php
/**
* 锁服务(用Memcache模拟锁)
*/
class Lock{
private $mc = null;
private $key_prefix = "memcache_lock_service_key_";
View vimrc
set number
syntax on
set hlsearch
set autochdir
set history=500
set incsearch "输入搜索内容时即显示搜索结果
set ruler
set shiftwidth=4 "设定<<和>>命令移动的宽度为4
set tabstop=4
set softtabstop=4 "退格键一次可以删除四个空格
View gist:2271597
#!/bin/bash
echo -n $1 | md5sum | awk '{print $1}'
You can’t perform that action at this time.