Skip to content

Instantly share code, notes, and snippets.

@ihipop
ihipop / Coreseek-4.1beta-gcc4.7+.patch
Created July 27, 2015 04:55
Patch for Sphinx/Coreseek 4.1 beta on Ubuntu14.04 LTS (gcc4.7+)
diff -ruN coreseek-4.1-beta/csft-4.1/buildconf.sh coreseek-4.1-beta.p0/csft-4.1/buildconf.sh
--- coreseek-4.1-beta/csft-4.1/buildconf.sh 2011-10-07 20:08:56.000000000 +0800
+++ coreseek-4.1-beta.p0/csft-4.1/buildconf.sh 2015-07-22 15:35:21.268304991 +0800
@@ -2,5 +2,5 @@
autoheader \
&& aclocal \
-&& automake --foreign \
+&& automake --add-missing --foreign \
&& autoconf
@ihipop
ihipop / CentOS
Last active January 14, 2021 20:44 — forked from vdel26/nginx
Openresty init.d script for CENTOS / DEBIAN / UBUNTU
#!/bin/sh
#
# chkconfig: 2345 55 25
# Description: Openresty init.d script, put in /etc/init.d, chmod +x /etc/init.d/openresty
# For Debian, run: update-rc.d -f openresty defaults
# For CentOS, run: chkconfig --add openresty
#
### BEGIN INIT INFO
# Provides: openresty
# Required-Start: $all
@ihipop
ihipop / decrypt 大众点评 POI with Python3
Created January 4, 2016 07:54
大众点评坐标解密样例代码
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
class test(object):
def base36encode(self,number):
"""Converts an integer into a base36 string."""
# From https://gist.github.com/kfr2/4287546
import string
ALPHABET = string.digits+string.ascii_lowercase
@ihipop
ihipop / getphone.sh
Last active February 2, 2016 09:47
中国电信在线选号测试
#!/bin/bash
#=====================Config======================
mainLog=phone.log
filterLog=phone.filter.log
maxTries=100
#=====================Config======================
function fetch {
curl -Ss --request GET \
--url 'http://js.189.cn/nmall/shop/number/queryNumber.json?areaId=16&areaCode=0510&numberHead=&showCount=50&isFour=&matchNum=&numberFee=-1&numberFlag=1' \
@ihipop
ihipop / delayRun
Last active February 16, 2017 09:30
delay run Command at random but certain time period without sleep in crontab
#!/bin/bash
#receive command
#you neet atd daemon to do this
cmd="$*"
echo $cmd
[[ $cmd == "" ]] && { echo 'Command Can Not be Empty' ; exit 1; }
command -v at >/dev/null 2>&1 || { echo "I require 'at command' but it's not installed. Aborting." >&2; exit 1; }
#set how many minutes to delay
range=2-350
echo 'sleep ' $(shuf -i 1-60 -n 1) ';' $cmd |at now + $(shuf -i $range -n 1) min
@ihipop
ihipop / phpbrew install 5.3.29 practise.md
Last active January 10, 2017 03:00
phpbrew install 5.3.29 practise
apt-get install build-essential autoconf
apt-get install libxml2-dev libevent-dev libgmp-dev libmysqlclient-dev libgd-dev libssl-dev libpng12-dev libjpeg-dev libbz2-dev libicu-dev libmcrypt-dev libreadline-dev libxslt-dev libltdl-dev libpq-dev libcurl4-openssl-dev libvmime-dev
ln -s /usr/include/freetype2 /usr/include/freetype2/freetype
phpbrew install 5.3.29 +default+dbs +gd +fpm +pdo +curl +json +hash +mbstring +fileinfo +soap +session +opcache +imap +readline +iconv

then vim /etc/rc.loal replace #!/bin/sh -e to #!/bin/bash -e in it,then add:

@ihipop
ihipop / phantomjs CJK Font.md
Last active May 9, 2017 08:10
phantomjs CJK Font
apt-get install fonts-droid-fallback ttf-wqy-zenhei ttf-wqy-microhei fonts-arphic-ukai fonts-arphic-uming xfonts-wqy ttf-mscorefonts-installer \
fonts-noto-cjk

IN Ubuntu 16.04 LTS

@ihipop
ihipop / IIS7 配置web.config使用重定向来规范主机域名 自适应HTTP HTTPS协议.md
Created June 12, 2016 04:03
IIS7 配置web.config使用重定向来规范主机域名 自适应HTTP/HTTPS协议 ///// IIS7 web.config Redirct to a Canonical Host Name with correct HTTP/HTTPS scheme
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="WWW Redirect Right property" stopProcessing="true">
                    <match url=".*"/>
                    <conditions>
                        <add input="{HTTP_HOST}" pattern="^www\.xxx\.cn$" negate="true" />
 
@ihipop
ihipop / awk中的时间处理例子.md
Last active November 4, 2016 09:15
awk中的时间处理例子

条件: 样本数据expr.txt列数未知 第一列是年份日期,第二列是时间,要求把第一二列整体代表的所在日期时间提前7583580秒(大约87.7天) 其他列原样输出

$ cat expr.txt 
2016-11-04 12:03 1478232180 col2 col2 col3
2016-08-08 17:30 1470648600 col2 none

例子如下

$ awk '{gsub(/-/," ",$1 );gsub(/:/," ",$2);d=$1" "$2" 00";d=mktime(d);d=d + 7583580;d=strftime("%Y-%m-%d %H:%M",d);out="";for (i=3;i&lt;=NF;i++){out=out" "$i};print d" "out }' expr.txt 
@ihipop
ihipop / wangka.py
Last active June 25, 2018 07:28
王卡选号程序
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# Created on 2016-11-23
# ihipop@gmail.com
import requests, time, random, json
from pprint import pprint
import logging