Skip to content

Instantly share code, notes, and snippets.

@rodrigoalviani
rodrigoalviani / plate-snitch.js
Created August 29, 2017 13:45 — forked from taitems/plate-snitch.js
(Extract) Check the status of a vehicle registration and scrape results.
// Open form and submit enquire for `rego`
function getInfo(rego) {
horseman
.userAgent('Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0')
.open(url)
.type('#registration-number-ctrl input[type=text]', rego)
.click('.btn-holder input')
.waitForSelector('.ctrl-holder.ctrl-readonly')
.html()
.then(function(body) {
@rodrigoalviani
rodrigoalviani / watermarkImage().js
Created June 12, 2017 16:56 — forked from westc/watermarkImage().js
Add a watermark text to the bottom right of any image element on the page that is on the same domain.
function watermarkImage(elemImage, text) {
// Create test image to get proper dimensions of the image.
var testImage = new Image();
testImage.onload = function() {
var h = testImage.height, w = testImage.width, img = new Image();
// Once the image with the SVG of the watermark is loaded...
img.onload = function() {
// Make canvas with image and watermark
var canvas = Object.assign(document.createElement('canvas'), {width: w, height: h});
var ctx = canvas.getContext('2d');
@rodrigoalviani
rodrigoalviani / webspider.hs
Created January 5, 2016 10:04 — forked from shangaslammi/webspider.hs
Haskell Web Spider example
import Control.Exception
import Control.Monad
import Control.Monad.IO.Class
import Data.ByteString.Lazy (ByteString)
import Data.ByteString.Lazy.UTF8 (toString)
import Data.Function
import Data.Enumerator
import Data.List
import Data.Maybe
-- | URL Doc : http://hackage.haskell.org/package/url-2.1.3/docs/Network-URL.html
module Page where
import Network.URL
import Network.Curl
import Text.XML.HXT.Core
import Text.HandsomeSoup
data Page = Page {
title :: String,
@rodrigoalviani
rodrigoalviani / tor_curl.php
Created November 17, 2015 14:27 — forked from zachflower/tor_curl.php
How To Anonymize PHP cURL Requests Using Tor
<?php
$ip = '127.0.0.1';
$port = '9051';
$auth = 'PASSWORD';
$command = 'signal NEWNYM';
$fp = fsockopen($ip,$port,$error_number,$err_string,10);
if(!$fp) { echo "ERROR: $error_number : $err_string";
return false;