Skip to content

Instantly share code, notes, and snippets.

@forthxu
forthxu / \Common\base32.php
Created November 9, 2017 03:36
可加密解密的base32
<?php
namespace Common;
/**
* 可加密解密的base32
*
* @author ForthXu
*/
class base32 {
@forthxu
forthxu / yxh_down.js
Created May 26, 2017 02:04
app下载处理
var Emt = (function() {
var env = {},
navigator = window.navigator,
userAgent = navigator.userAgent,
ios = userAgent.match(/(iPad|iPhone|iPod)[^;]*;.+OS\s([\d_\.]+)/),
android = userAgent.match(/(Android)\s([\d\.]+)/);
env.isAndroid = (/android/gi).test(navigator.appVersion);
env.isIDevice = (/iphone|ipad|ipod/gi).test(navigator.appVersion);
env.isWebkit = /WebKit\/[\d.]+/i.test(userAgent);
env.isSafari = ios ? (navigator.standalone ? env.isWebkit : (/Safari/i.test(userAgent) && !/CriOS/i.test(userAgent) && !/MQQBrowser/i.test(userAgent))) : false;
@forthxu
forthxu / CheckForbiddenWords.py
Created March 21, 2017 04:45
Python全站内容抓取、URL扫描 实例:用于扫描自己的网站的违禁词连接和对应的违禁词
#!/usr/bin/python
# -*- coding:utf-8 -*-
# Orignal Author: FrankHacker
# Modified by Linson @691000737
# Require requests module, python3.x+
# 处理常见违禁词,全站扫描,违禁词可以从自己的网站导出成json格式,替换13行内容
# 程序会在当前目录生成badword.txt文件
import requests
import re,json
-- a quick LUA access script for nginx to check IP addresses against an
-- `ip_blacklist` set in Redis, and if a match is found send a HTTP 403.
--
-- allows for a common blacklist to be shared between a bunch of nginx
-- web servers using a remote redis instance. lookups are cached for a
-- configurable period of time.
--
-- block an ip:
-- redis-cli SADD ip_blacklist 10.1.1.1
-- remove an ip:
@forthxu
forthxu / qq_message_xml.md
Created November 20, 2016 11:08 — forked from koukuko/qq_message_xml.md
发送XML消息的格式

QQ的XML消息格式整理

QQ可以使用xml的方式发送消息,以下为了方便描述统称为卡片。

发送方式

通过机器人的API进行发送xml即可,但是如果选择发送xml,那么其他如[image=xxx][@xxx]这些命令就不可使用了。整个消息只有XML。

基本结构

xml主要由msg,item,source这3部分组成

<?xml version='1.0' encoding='utf-8' standalone='yes'?>
<?php
//http://blog.codinglabs.org/articles/write-daemon-with-php.html
//Accpet the http client request and generate response content.
//As a demo, this function just send "PHP HTTP Server" to client.
function handle_http_request($address, $port)
{
$max_backlog = 16;
$res_content = "HTTP/1.1 200 OK
Content-Length: 15
Content-Type: text/plain; charset=UTF-8
@forthxu
forthxu / scrapting_wechat.python
Last active August 31, 2018 04:26
chuansong.me 传送门指定公众号文章采集 && 利用phantomjs对网页进行截图 && 抓取搜狗微信
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import urllib2
import time
import csv
import sys,os
import pymysql
def get_cur_file_dir():
@forthxu
forthxu / daemon.c
Last active June 22, 2016 03:23
守护进程
#include < stdio.h >
#include < time.h >
void init_daemon(void);//守护进程初始化函数
/**
* 编译:gcc -g -o daemon init.c daemon.c
* 执行:./daemon
* 查看进程:ps -ef | grep daemon
*/
@forthxu
forthxu / data.php
Last active March 29, 2016 06:34
业务需要,抓取页面排名数据保存,月末发邮件
<?php
foreach (glob("./data/*.html") as $filename) {
echo "<a href='$filename'>$filename</a><br/>";
}
?>