Skip to content

Instantly share code, notes, and snippets.

@brianpow
brianpow / greasemonkey-taobao-no-track
Last active December 11, 2018 15:44
Remove spm tracking when visiting taobao.com
// ==UserScript==
// @name Taobao no spm tracking
// @namespace com.brianpow@gmail.com
// @description If you click any link in taobao, a tracking element named spm will be sliently added to the link, which is used for tracking users. This script will prevent the addition of spm or other suspecious element to link and clean up all forms.
// @version 1
// @grant none
// @include /^https?://.*\.taobao\.com/
// @author Brian Pow
// @license GPL version 2 or any later version; http://www.gnu.org/licenses/gpl-2.0.txt
// @run-at document-end
@brianpow
brianpow / greasemonkey-jumbo-computer-pricelist-search-enhancement
Last active August 29, 2015 14:19
Enhance the search field of price list of jumbo-computer.com with highlight
// ==UserScript==
// @name Jumbo-computer pricelist search enhancement
// @namespace com.brianpow
// @description Allow searching the price list with client-side javascript instead of submitting to server. Highlight matches words in product name. Support multiple keywords.
// @version 1
// @grant none
// @include /^https?://.*\.jumbo-computer\.com\/pricelist\.aspx/
// @author Brian Pow
// @license GPL version 2 or any later version; http://www.gnu.org/licenses/gpl-2.0.txt
// @run-at document-end
@brianpow
brianpow / greasemonkey-no-modal-dialog
Last active August 29, 2015 14:19
Redirect all showModalDialog function call to open (modeless dialog), which allows content copying.
// ==UserScript==
// @name No Modal Dialog
// @namespace com.brian
// @description Redirect all showModalDialog function call to open (modeless dialog), which allows content copying.
// @version 1
// @include *
// @run-at document-start
// @grant none
// ==/UserScript==
showModalDialog = window.showModalDialog = open
@brianpow
brianpow / grub4dos-avira-rescue-system.txt
Last active October 18, 2015 15:41
grub4dos-avira-rescue-system
title Avira Antivir Rescue System
set avira_is=/iso/av/rescue-system.iso
set avira_co=file=/cdrom/preseed/ubuntu.seed boot=casper iso-scan/filename=%avira_is% -- debian-installer/language=en console-setup/layoutcode=en
map %avira_is% (0xff) || map --mem %avira_is% (0xff)
map --hook
root (0xff)
kernel /casper/vmlinuz %avira_co%
initrd /casper/initrd.lz
title Avira Antivir Rescue System - ask VGA mode
String.prototype.parseisolinux = function(){
dicts={
"menu label ":["title ",0],
"menu quit":["commandline",1],
"kernel ":["kernel ",1],
}
direct_tr={"timeout ":["timeout ",1]}
rows=this.split("\n");
entries=[]
entry=[]
title=["Brand","Name","Size","Price"];
selectors=["dl.productWrapper:eq(0) strong:eq(0)",
"dl.productWrapper:eq(0) a.breakWorkW",
"dl.productWrapper:eq(0) span:eq(0)",
"dl.productWrapper:eq(1) font:eq(0)"];
all=[]
jQuery("div.productCol").each(function(){
a=[];
for(var i in selectors)
a.push(jQuery(selectors[i],this).text().trim());
for /L %%a in (1,1,9) do (
for /L %%b in (0,1,10) do (
call wget -O "0%%a-%%b.html" "http://parknshop.com/1/lc/0%%a0000?resultsForPage=100&page=%%b"
)
)
for /L %%a in (10,1,20) do (
for /L %%b in (0,1,10) do (
call wget -O "%%a-%%b.html" "http://parknshop.com/1/lc/%%a0000?resultsForPage=100&page=%%b"
@brianpow
brianpow / grab-email-address-from-text.js
Last active December 21, 2016 16:10
Grab email address from text
var data = [];
$(document.body).text().replace(/[\w\.]+@[\w\.]+/g, function(a){if(data.indexOf(a) == -1) data.push(a);});
console.log(data.join(","));
@brianpow
brianpow / gist:d19f98ddef5cf7ad504a632b5abfe213
Last active February 20, 2024 15:02 — forked from TobiasWooldridge/gist:22f0cdca75190b9a473f
How to Unbrick a Kindle Paperwhite

How to unbrick an Amazon Kindle Paperwhite?

This guide instructs you in how to unbrick an Amazon Kindle Paperwhite. The consequences of following it are your own responsibility. This method (opening the Kindle and using the serial interface) should be a last resort and should only be considered if other methods fail

Prerequisite

Hardware

  • Prying tool
  • Screw driver
  • USB to serial cable (1.8V the best, other not tried and may fried your kindle)
  • USB to micro USB cable
@brianpow
brianpow / bookmarklet-price.com.hk.js
Created December 21, 2016 16:08
a little script to dump the price information of price.com.hk, it will show a textarea under the page when done
/*! URI.js v1.18.4 http://medialize.github.io/URI.js/ */
/* build contains: IPv6.js, punycode.js, SecondLevelDomains.js, URI.js, URITemplate.js, jquery.URI.js */
(function(d,k){"object"===typeof module&&module.exports?module.exports=k():"function"===typeof define&&define.amd?define(k):d.IPv6=k(d)})(this,function(d){var k=d&&d.IPv6;return{best:function(g){g=g.toLowerCase().split(":");var d=g.length,b=8;""===g[0]&&""===g[1]&&""===g[2]?(g.shift(),g.shift()):""===g[0]&&""===g[1]?g.shift():""===g[d-1]&&""===g[d-2]&&g.pop();d=g.length;-1!==g[d-1].indexOf(".")&&(b=7);var l;for(l=0;l<d&&""!==g[l];l++);if(l<b)for(g.splice(l,1,"0000");g.length<b;)g.splice(l,0,"0000");
for(l=0;l<b;l++){for(var d=g[l].split(""),k=0;3>k;k++)if("0"===d[0]&&1<d.length)d.splice(0,1);else break;g[l]=d.join("")}var d=-1,q=k=0,t=-1,n=!1;for(l=0;l<b;l++)n?"0"===g[l]?q+=1:(n=!1,q>k&&(d=t,k=q)):"0"===g[l]&&(n=!0,t=l,q=1);q>k&&(d=t,k=q);1<k&&g.splice(d,k,"");d=g.length;b="";""===g[0]&&(b=":");for(l=0;l<d;l++){b+=g[l];if(l===d-1)break;b+=":"}""===g