Skip to content

Instantly share code, notes, and snippets.

View horsley's full-sized avatar

Horsley Lee horsley

View GitHub Profile
@horsley
horsley / main.go
Created August 14, 2013 05:25
文件分割器 for jokerdeng
// lineSpliter project main.go
package main
import (
"bufio"
"fmt"
"os"
"path/filepath"
"strconv"
"strings"
@horsley
horsley / rsync.php
Last active July 16, 2018 10:17
rsync shell 拉取模式,其实除非你要用inotify做实时备份,否则定时备份根本就用不着用rsync daemon,直接通过shell拉取就好。当然要配好无密码的公约密码登录,让备份服务器可以访问到待备份的数据。
#!/usr/sbin/php
<?php
/*
* Rsync备份脚本
*/
set_time_limit(0);
date_default_timezone_set('Asia/Shanghai');
define('CONF_SRC', 'backup_src');
define('CONF_DST', 'backup_dest');
@horsley
horsley / mysql_backup.sh
Created June 30, 2013 19:14
mysql分库备份脚本
#!/bin/bash
#以下信息请自行修改
MYSQL_DIR=/usr/local/mysql #mysql目录
MYSQL_USER=root #mysql用户名
MYSQL_PASS=123456 #mysql密码
BACKUP_DIR=/backup #存放备份文件的目录
#以上信息自行修改
#定义数据库的名字和旧数据库的名字
DataBakName=Data_$(date +”%Y%m%d”).tar.gz
@horsley
horsley / .screenrc
Created June 28, 2013 13:20
my screenrc
termcap vt102 ''
hardstatus on
hardstatus alwayslastline
hardstatus string '%{=b}%{b}%-w%{.BW}%10>[%n %t]%{-}%+w%< %=%{G}%H %{-b}%{w}%Y/%m/%d %c:%s'
vbell off
defscrollback 1000
windows
# 退出vim/nano之后自动刷新屏幕
altscreen on
@horsley
horsley / littlealchemy formula
Last active December 18, 2015 13:09
littlealchemy formula
water = ice + fire
water = egg + hourglass
fire : final
earth : final
air : final
steam = water + fire
steam = water + energy
lava = earth + fire
pressure = earth + earth
pressure = air + air
<?php
/**
* @author Anush Prem <goku.anush@gmail.com>
* @package Solver
* @subpackage Sudoku
* @version 0.1
*/
/**
@horsley
horsley / jnulib.php
Created March 26, 2013 17:28
暨南大学图书馆搜书接口
<?php
/**
* Created by JetBrains PhpStorm.
* User: Horsley
* Date: 12-4-30
* Time: 下午3:47
* To change this template use File | Settings | File Templates.
*/
$act = $_GET['action'];
switch($act){
@horsley
horsley / awstats_trigger.php
Created February 6, 2013 16:50
multi configs's awstats update script
#!/usr/bin/php
<?php
/**
* Created by JetBrains PhpStorm.
* User: horsley
* Date: 13-1-30
* Time: 上午1:00
* To change this template use File | Settings | File Templates.
*
* cron -e and add this file , remember chmod + x
@horsley
horsley / vps_status.php
Last active December 12, 2015 05:19
A simple PHP script to get vps's status from solus api
<?php
/**
* A simple PHP script to get vps's status from solus api
*
*/
set_time_limit(180);
$serv_array = array(
array(//an vps
'api_server' => 'https://solus.hostigation.com:5656', //panel login page
// Implementation of a UDP proxy
package main
import (
"flag"
"fmt"
"log"
"net"
"os"