Skip to content

Instantly share code, notes, and snippets.

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>田字格字帖生成器</title>
<style>
body,
div,
p,
@hemon
hemon / 取消关注.js
Last active July 7, 2020 06:57
微博取消关注
$("a[action-type=batselect").click(); // 点击“批量管理”按钮
// 选中所有条目
var items = $$('div.markup_choose');
for (var i=0;i<items.length;i++) {
items[i].click();
}
$("a[action-type=cancel_follow_all]").click() //点击“取消关注”
$("a[action-type=ok]").click() // 点击“确定”
<?php
declare(ticks = 1);
$max = 4;
$child = 0;
function sig_handler($signo) {
global $child;
switch ($signo) {
case SIGCHLD:
__lookback = setInterval(()=>{
console.log([
document.querySelector("#bottom-area > div.bottom-widgetbar-content.backtesting > div.backtesting-content-wrapper > div > div > div.report-data > div:nth-child(3) > strong").innerHTML.replace('&nbsp;',''),
document.querySelector("div > div.report-data > div:nth-child(1) > p > span").innerHTML.replace('&nbsp;',''),
document.querySelector("div > div.report-data > div:nth-child(5) > p > span > span").innerHTML.replace('&nbsp;','')
].join("\t"))
}, 3000)
clearInterval(__lookback)
@hemon
hemon / pupetter_mqtt.js
Created May 17, 2019 16:33
puppeteer with mqtt
const Puppeteer = require('puppeteer');
const EventEmitter = require('events');
class Emitter extends EventEmitter {}
const Event = new Emitter();
Event.on('goto', async (data) => {
console.log('goto:'+data.url);
browser = await Puppeteer.launch({headless: false});
page = await browser.newPage();
<?php
function ip_in_china_bmp($ip, $bmp='china_ip_list.bmp') {
$offset = is_numeric($ip) ? $ip : ip2long($ip);
$fp = fopen($bmp, 'r');
if (fseek($fp, ceil($offset / 8) - 1)) return FALSE;
$byte = fread($fp, 1);
$res = $byte & pack('C', 256 >> (fmod($offset - 1, 8) + 1));
return (!$res || $res === "\0") ? 0 : 1;
}
@hemon
hemon / china_ip_list.php
Last active March 20, 2019 07:55
17mon/china_ip_list.php
<?php
function ip_in_range( $ip, $range ) {
if ( strpos( $range, '/' ) == false ) {
$range .= '/32';
}
// $range is in IP/CIDR format eg 127.0.0.1/24
list( $range, $netmask ) = explode( '/', $range, 2 );
$range_decimal = ip2long( $range );
$ip_decimal = ip2long( $ip );
$wildcard_decimal = pow( 2, ( 32 - $netmask ) ) - 1;
var marketOrder = {
orderId : 0,
timeout : 60,
parameters : {},
make : function(method, parameters, timeout) {
var $this = this;
this.timeout == (timeout === undefined ? this.timeout : timeout);
this.symbol = parameters.symbol;
this.parameters = parameters;
this.method = method;
@hemon
hemon / srcache.lua
Last active January 14, 2016 04:08
-- http {
-- lua_shared_dict srcache 100m;
-- lua_shared_dict srcount 10m;
-- lua_shared_dict srlock 10m;
-- server {
-- rewrite_by_lua_file srcache.lua;
local srcache = ngx.shared.srcache
local srcount = ngx.shared.srcount
@hemon
hemon / installphp7.sh
Created October 17, 2015 10:07 — forked from tronsha/installphp7.sh
Install PHP7 to Ubuntu
#!/bin/bash
apt-get update
apt-get install -y git-core autoconf bison libxml2-dev libbz2-dev libmcrypt-dev libcurl4-openssl-dev libltdl-dev libpng-dev libpspell-dev libreadline-dev
mkdir -p /etc/php7/conf.d
mkdir -p /etc/php7/cli/conf.d
mkdir /usr/local/php7
cd /tmp
git clone https://github.com/php/php-src.git --depth=1
cd php-src
./buildconf