Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<?php
$base_dir = $argv[1];
$rs_dir = opendir($base_dir);
while ($filename = readdir($rs_dir)) {
if (false === strpos($filename, '.doc')) {
continue;
}
$filepath = $base_dir . '/' . $filename;
$arr_line = file($filepath);
$boundary = '';
<?php
preg_replace("/[^\x{4e00}-\x{9fa5}A-Za-z0-9 ,_!@#$%*;?]/u", "", $str);
@caiyili
caiyili / goto.sh
Last active August 29, 2015 14:06
ssh connect between two machine
#!/bin/sh
CONF=$HOME/.local/etc/goto.conf
EXPECT=$HOME/.local/bin/doexpect.sh
function goto {
if [[ "$1" == "-l" || "$1" == "" ]] ;then
__list_info
else
@caiyili
caiyili / script.php
Last active January 3, 2016 15:59
计算微博上一个题目的脚本!
<?php
$allSortFile = "allSort.txt" ;
if (!file_exists($allSortFile)){
$fout = fopen($allSortFile,"w");
$allSolution = allSort(1,10);
foreach($allSolution as $item){
$line = implode("\t",$item) ;
fputs($fout,$line . "\n") ;
}
fclose($fout) ;
@caiyili
caiyili / printc.sh
Created September 27, 2013 07:22
printc.sh 打印有颜色的字符
#!/bin/sh
function printc()
{
local color=$1
local msg=$2
if [ "$msg" = "" ] ; then
echo "printc: usage: printc color<yellow|green|blue|red|skyblue> msg"
fi
if [ "$color" = "yellow" ];then
@caiyili
caiyili / bashmarks.sh
Created September 27, 2013 07:21
bashmarks.sh 一个shell下的书签,可以把目录保存为书签,方便跳转
# Copyright (c) 2010, Huy Nguyen, http://www.huyng.com
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without modification, are permitted provided
# that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this list of conditions
# and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
# following disclaimer in the documentation and/or other materials provided with the distribution.
@caiyili
caiyili / vimrc
Last active December 17, 2015 18:49
VIM配置文件
" ======================================================================================
" File : .vimrc
" Author : Wu Jie
" Last Change : 12/02/2009 | 12:02:28 PM | Wednesday,December
" Description :
" ======================================================================================
"/////////////////////////////////////////////////////////////////////////////
" exVim global settings
" NOTE: you should change to your own settings.
@caiyili
caiyili / MyVimrc.vim
Last active December 17, 2015 18:49
轻量级的vim的配置文件
""""""let mapleader"""""
let mapleader=","
let g:mapleader=","
""""""ignorecases"""""
set ignorecase
set incsearch
"""""show numbers"""""
set number
"""""set the tab width"""""
@caiyili
caiyili / Markdown.xml
Created April 27, 2013 19:49
sublime text 2 的markdown高亮的插件。 To get the results as shown in the screenshot above, edit your theme file (~/Library/Application Support/Sublime Text 2/Packages/Color Scheme - Default/Monokai.tmTheme) and paste in the code below (which is inspired upon this gist) just before the </array>
<!-- copy this to YOUR_THEME.tmTheme-->
<dict>
<key>name</key>
<string>diff: deleted</string>
<key>scope</key>
<string>markup.deleted</string>
<key>settings</key>
<dict>
<key>background</key>
<string>#EAE3CA</string>