Skip to content

Instantly share code, notes, and snippets.

View xhat's full-sized avatar
🤒
Out sick

xhat xhat

🤒
Out sick
View GitHub Profile
@xhat
xhat / gist:3952722
Created October 25, 2012 14:02
alias cd
alias cd=x1
function x1() {
builtin cd "$@"
ls
}
--------------------------------
贴gist到v2ex的方法是直接粘贴链接如:
http://gist.github.com/3952722
--------------------------------
alias cd=x1
function x1() {
builtin cd "$@"
ls | head -20
}
--------------------------------
贴gist到v2ex的方法是直接粘贴链接如:
http://gist.github.com/3952722
--------------------------------
@xhat
xhat / gist:4544210
Last active December 11, 2015 04:18
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Test Page</title>
<style>
#main{width:500px;}
li{list-style:none;font-size:14px;line-height:26px;}
a{color:#000; text-decoration:none;}
a:hover{color:red; text-decoration:none;}
.right{float:right;}
import urllib2
def xiami_decode(s):
s = s.strip()
if not s:
return False
result = []
line = int(s[0])
rows = len(s[1:]) / line
extra = len(s[1:]) % line
#/bin/bash
URL="http://192.168.5.100/xxx.php"
check() {
RESULT=$(curl -s $URL)
echo $RESULT
if [ "$RESULT" -eq "1111" ] ; then
echo "again"
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import sys
import logging
import datetime
import requests
import BeautifulSoup
from requests.adapters import HTTPAdapter
@xhat
xhat / sign.php
Last active June 7, 2017 23:04
payjs.cn签名方法
<?php
/**
* 签名方法:
* 1.把所有参数根据参数名首字母asc码排序
* 2.以键值 http querystring 方式连接
* 3.取md5值转化为大写
*/
function sign(array $data)
<div class="main">
<div class="hr">演示代码</div>
<p><input id="money" name=money placeholder="输入金额,单位:分"></p>
<p>
<input type="radio" name="pay" value="wxpay" checked > 微信支付
<input type="radio" name="pay" value="alipay" > 支付宝
<input type="radio" name="pay" value="jdpay" > 京东钱包
<input type="radio" name="pay" value="qpay" > QQ钱包
<div class="mainbody">
<div class="demo_title">演示代码</div>
<div class="blank"></div>
<p id="m-radio">
<input type="radio" name="money" value="10" checked > 0.1元
<input type="radio" name="money" value="500" > 5元
<input type="radio" name="money" value="1000" > 10元
<input type="radio" name="money" value="5000" > 50元
</p>
<?php
class Payjs
{
private $url = 'https://payjs.cn/api/native';
private $key = ''; // 填写通信密钥
private $mchid = ''; // 特写商户号
public function __construct($data=null) {
$this->data = $data;
}