Skip to content

Instantly share code, notes, and snippets.

View lifesign's full-sized avatar
🎯
Focusing

Feng lifesign

🎯
Focusing
View GitHub Profile
@lifesign
lifesign / registry.php
Created February 8, 2014 05:19
simple singleton registry
class Registry {
private static $table;
static function exists($key) {
return isset(self::$table[$key]);
}
static function set($key, $val) {
return self::$table[$key] = $val;
}
@lifesign
lifesign / gist:8970120
Created February 13, 2014 05:16
mv multiple file
#!/usr/bin/env python
import os
for i in range(1,34):
print os.system("yes|mv /data/xxx/%d xxxx/xxx/%d" % (i, i))
@lifesign
lifesign / ok.python
Created February 15, 2014 08:47
db insert
#!/usr/bin/env python
#coding:utf-8
# --*-- encoding:utf-8 --*--
'''
Created on 2013-10-13
@author: poorevil
'''
import json,sys,linecache,time
@lifesign
lifesign / nginx
Created February 17, 2014 07:21
nginx manager scrpit
sudo chmod +x /etc/init.d/nginx
sudo /sbin/chkconfig nginx on
# 检查一下
sudo /sbin/chkconfig --list nginx
nginx 0:off 1:off 2:on 3:on 4:on 5:on 6:off
#finished
service nginx start
service nginx stop
service nginx restart
@lifesign
lifesign / php-fpm
Created February 17, 2014 07:24
php-fpm_manager
#!/bin/bash
#
# Startup script for the PHP-FPM server.
#
# chkconfig: 345 85 15
# description: PHP is an HTML-embedded scripting language
# processname: php-fpm
# config: /usr/local/php/etc/php.ini
# Source function library.
@lifesign
lifesign / start.php
Created March 20, 2014 15:59
laravel3 tracy
<?php
Autoloader::namespaces(array(
'Tracy' => Bundle::path('tracy') . 'lib' . DS . 'src' .DS .'Tracy',
));
if (!IoC::registered('tracy')) {
IoC::singleton('tracy', function () {
Tracy\Debugger::enable();
}
);
location /resize {
alias /tmp/nginx/resize;
set $width 150;
set $height 100;
set $dimens "";
if ($uri ~* "^/resize_(\d+)x(\d+)/(.*)" ) {
set $width $1;
set $height $2;
set $image_path $3;
@lifesign
lifesign / update.php
Last active February 27, 2017 09:53
纯真数据库自动更新
<?php
/*
纯真数据库自动更新原理实现
示例代码使用php实现,从copywrite.rar中读取解密需要的一个key,然后解密qqwry.rar头0x200字节数据,随后使用zlib解压数据即可得到qqwry.dat文件
通过此代码的实现,你应该可以自行实现一个纯真数据库更新工具。copywrite.rar中还有一些更多的数据,没有一一列出,比如版本号、qqwry.rar文件大小。
collect from https://github.com/shuax/QQWryUpdate/blob/master/update.php
*/
$copywrite = file_get_contents("http://update.cz88.net/ip/copywrite.rar");
$qqwry = file_get_contents("http://update.cz88.net/ip/qqwry.rar");
<?php
class ColorCLI {
static $foreground_colors = array(
'bold' => '1', 'dim' => '2',
'black' => '0;30', 'dark_gray' => '1;30',
'blue' => '0;34', 'light_blue' => '1;34',
'green' => '0;32', 'light_green' => '1;32',
'cyan' => '0;36', 'light_cyan' => '1;36',
<?php
set_time_limit(300);
error_reporting(E_ALL);
class test {
function func() {}
}