Skip to content

Instantly share code, notes, and snippets.

💭
🔥 Make Things Happen!

小胡子哥 barretlee

💭
🔥 Make Things Happen!
Block or report user

Report or block barretlee

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View performance.js
var readyStart = timing.fetchStart - timing.navigationStart;
var redirectTime = timing.redirectEnd - timing.redirectStart;
var appcacheTime = timing.domainLookupStart - timing.fetchStart;
var unloadEventTime = timing.unloadEventEnd - timing.unloadEventStart;
var lookupDomainTime = timing.domainLookupEnd - timing.domainLookupStart;
var connectTime = timing.connectEnd - timing.connectStart;
var requestTime = timing.responseEnd - timing.requestStart;
var initDomTreeTime = timing.domInteractive - timing.responseEnd;
var domReadyTime = timing.domComplete - timing.domInteractive;
var loadEventTime = timing.loadEventEnd - timing.loadEventStart;
@barretlee
barretlee / clear.js
Last active Feb 13, 2018
Clear Linkedin 'Following' in one second
View clear.js
// open: https://www.linkedin.com/feed/following/
// Attention: versionTag(TODO)
var csrf_token, lang, instance, track, version;
function fetchList(start, count) {
return $.ajax({
url: "https://www.linkedin.com/voyager/api/feed/richRecommendedEntities",
dataType: 'json',
data: {
@barretlee
barretlee / weibopicbed.js
Created Jul 16, 2017 — forked from easychen/weibopicbed.js
微博图床上传函数
View weibopicbed.js
// from https://github.com/suxiaogang/WeiboPicBed
// under its license
function uploadToWeibo( url , callback )
{
var xhr = new XMLHttpRequest();
xhr.onload = function() {
var reader = new FileReader();
reader.onloadend = function( e )
{
@barretlee
barretlee / alfred-pinyin.py
Created Mar 11, 2017 — forked from tiann/alfred-pinyin.py
make alfred support pinyin search
View alfred-pinyin.py
#! /usr/bin/python
# -*- coding: utf-8 -*-
# @author weishu @2015/12/7
import subprocess
import os
import re
import json
@barretlee
barretlee / xmq.js
Last active Apr 15, 2017
xmq data spider
View xmq.js
const fs = require('fs');
const request = require('request');
const BASE = 'https://api.xiaomiquan.com/v1.2/groups/4512888248/topics';
const ORIGIN = 'https://wx.xiaomiquan.com';
const REFERER = 'https://wx.xiaomiquan.com/dweb/';
const UA = 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36';
const AUTHORIZATION = 'xxx';
const pageSize = '?count=20';
const end_time = (t) => t ? `&end_time=${encodeURIComponent(t)}` : t;
View index.html
<script src="http://cdn.staticfile.org/socket.io/1.3.7/socket.io.js"></script>
<script src="http://cdn.staticfile.org/jquery/2.2.1/jquery.min.js"></script>
<script>
function htmlspecialchars(str){
str = str || '';
str = str.replace(/&/g, '&amp;');
str = str.replace(/</g, '&lt;');
str = str.replace(/>/g, '&gt;');
str = str.replace(/"/g, '&quot;');
View doublebits.js
const db = require('double-bits');
const pad = require('pad');
// [lo, hi] where lo is a 32 bit integer and hi is a 20 bit integer.
const base2Str = (n) => {
const f = db.fraction(n);
const s = db.sign(n) ? '-' : '';
const e = `2^${db.exponent(n) + 1}`;
const t = `0.${pad(f[1].toString(2), 20, '0')}${pad(f[0].toString(2), 32, '0')}`;
return `${s}${e} * ${t}`;
View mongo.js
var MongoClient = require('mongodb').MongoClient;
var mg = require('../config').mongodb;
var DB = function(){
this.url = "mongodb://" + mg['host'] + ":" + mg['port'] + "/" + mg['database'];
};
module.exports = new DB;
DB.prototype.connect = function(cb){
View mongo.js
var MongoClient = require('mongodb').MongoClient;
var mg = require('../config').mongodb;
var DB = function(){
this.url = "mongodb://" + mg['host'] + ":" + mg['port'] + "/" + mg['database'];
};
module.exports = new DB;
DB.prototype.connect = function(cb){
You can’t perform that action at this time.