Skip to content

Instantly share code, notes, and snippets.

View firedfox's full-sized avatar
🎯
Focusing

Daniel Wang firedfox

🎯
Focusing
  • Weimob
  • Shanghai, China
  • 11:15 (UTC +08:00)
View GitHub Profile
@firedfox
firedfox / node-proxy.js
Last active June 28, 2016 19:32
node proxy with basic auth
const http = require('http');
const httpProxy = require('http-proxy');
const port = 8128;
const username = 'username';
const password = 'password';
const authBuffer = Buffer.from(username + ':' + password, 'ascii');
const authToken = 'Basic ' + authBuffer.toString('base64');
@firedfox
firedfox / format-url-for-phantom.js
Last active March 30, 2016 15:36
format url for phantom
/**
* @file format url for phantom
* @author firedfox
*/
/*
* format url before opened by a WebPage instance
*
* @param {string} url web page url
* @return {string} url formatted
@firedfox
firedfox / CustomRules.js
Last active November 16, 2015 03:22
fiddler custom rules
static function OnBeforeRequest(oSession: Session) {
if (oSession.HostnameIs("hm.baidu.com")) { oSession.host = "10.46.45.31:8001"; }
}
var PriorityQueue = require('bull/lib/priority-queue');
var queue = new PriorityQueue('jobQueue', 6379, '127.0.0.1');
var MAX = 10000;
var n = 0;
var addToQueue = function() {
queue.add(
/**
* @file trigger click on an element and capture the url
* @author wangyang02
*
* @example
* phantomjs click.js https://www.baidu.com/ 'a[name=tj_trnews]'
* phantomjs click.js https://www.baidu.com/ '#su'
*/
/* eslint-disable */
// example:
// phantomjs getComputedStyle.js "http://www.iqiyi.com/" ".usrTxGeneral-box_hover" "position,display,visibility,overflow"
var TIMEOUT = 60 * 1000;
var webPage = require('webpage');
var system = require('system');
var page = webPage.create();
page.settings.loadImages = false;
#!/bin/bash
TARGET_URL='http://hm.baidu.com/h.js?5bd903f7f409c54caa0df0909fbf2a76';
TARGET_ETAG='cab267c293ff3512bd775692a76b1586';
EXPECT_RESPONSE_STATUS='304 Not Modified';
LOG_URL='http://q.hm.baidu.com/gfw-hijack-detector-server/log';
CONNECT_TIMEOUT=30;
LOAD_MAX_TIME=60;
DETECT_TOTAL_COUNT=5;
DETECT_INTERVAL=10;
// 默认广告配置
var CPRO_STYLE_API = {
"tn": "template_inlay_all_normal", // 模板
"at": "text", // 物料类型
"urlis": 0, // 是否显示广告链接
"desis": 0, //是否显示主题标题描述词
"consl": 0, //是否显示广告块LOGO
"titsu": 0, //是否显示文字下划线
"titpl": 6, //广告块文字左填充值,右填充为titpr
"conpt": 0,
/**
* 百度统计订单跟踪
*
* 注意事项:
* 1. 页面需要安装百度统计的异步js代码,建议安装在页面顶部 </head> 标签之前,详情请参考获取代码页面的帮助信息。
* 2. 调用订单跟踪接口的位置,要在百度统计异步js代码的后面,至少要在 var _hmt = _hmt || []; 语句之后。
* 3. 所有字段名必须与示例中给出的名称保持字母和大小写完全一致。
*/
// 接口格式。