Skip to content

Instantly share code, notes, and snippets.

@brianpow
brianpow / bookmarklet-iherb.com-parser.js
Last active October 3, 2017 15:17
Create a textarea with price and product details in tab-separated format in current category of www.iherb.com
(function($) {
var parse = function($$) {
var category = $$.find("h1.sub-header-title").get(0).childNodes[0].nodeValue.trim() || ""
return $$.find("div.container-fluid-bs > div.row:odd").map(function() {
let $li = $("li", this)
let data = [category,
$("div.product-title", this).text().trim(),
$("div.price", this).text().trim(),
$("div.product-discount-container span", this).text().trim()
@brianpow
brianpow / a7020a48
Last active February 14, 2017 06:25
http://phonedl.ota.lenovomm.com/dls/v6/A7020a48_S122_160405_ROW_TO_A7020a48_S125_160419_ROW_WC8B95A21E.zip
http://phonedl.ota.lenovomm.com/dls/v6/A7020a48_S259_160721_ROW_TO_A7020a48_S312_160926_ROW_WC4B1E7903.zip
http://phonedl.ota.lenovomm.com/dls/v6/A7020a48_S312_160926_ROW_TO_A7020a48_S318_161128_ROW_WC04A2F728.zip
@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
@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 / 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(","));
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"
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());
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=[]
@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
@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