Skip to content

Instantly share code, notes, and snippets.

View Rui-Santos's full-sized avatar

Rui J Santos Rui-Santos

View GitHub Profile
@Rui-Santos
Rui-Santos / README.md
Created February 12, 2016 09:51 — forked from teffalump/README.md
OpenWRT adblock implementation

Others have recently developed packages for this same functionality, and done it better than anything I could do. Use the packages instead of this script:

Description

In its basic usage, this script will modify the router such that blocked addresses are null routed and unreachable. Since the address blocklist is full of advertising, malware, and tracking servers, this setup is generally a good thing. In addition, the router will update the blocklist weekly. However, the blocking is leaky, so do not expect everything to be blocked.

@Rui-Santos
Rui-Santos / README.md
Created January 23, 2016 20:27 — forked from itay-grudev/README.md
BT WiFi Maintain Connectivity Script

BT WiFi Maintain Connectivity Script

Usage

btauth --user USER_OR_EMAIL --pass PASSWORD # To Authenticate with the BT WiFi
btmaintain --user USER_OR_EMAIL --pass PASSWORD # To maintain a connection and re-authenticate automatically
nohup btmaintain --user USER_OR_EMAIL --pass PASSWORD 2>&1 >/dev/null & # Same as above but ran in background
// (…)
var childProcess;
try {
childProcess = require("child_process");
} catch (e) {
this.log(e, "error");
}
if (childProcess) {
childProcess.execFile("/bin/bash", ["mycommand.sh", args1, args2, args3], null, function (err, stdout, stderr) {
this.log("execFileSTDOUT:", JSON.stringify(stdout), 'debug');
var active = false;
function changeRefer(details) {
if (!active) return;
for (var i = 0; i < details.requestHeaders.length; ++i) {
if (details.requestHeaders[i].name === 'Referer') {
details.requestHeaders[i].value = 'http://www.google.com/';
break;
}
// Run as: casperjs --cookies-file=cookies.txt SE_get_close_votes.js
// to skip logging in the next time or simply: casperjs SE_get_close_votes.js
// Don't forget to input your credentials
// The login is not perfect, so it might fail. Just try again.
var casper = require('casper').create({
viewportSize: {
width: 1280,
height: 800
},
var system = require('system');
if (system.args.length < 5) {
console.info("You need to pass in account name, username, password, and path to casperJS as arguments to this code.");
phantom.exit();
}
var account = system.args[1];
var username = system.args[2];
var password = system.args[3];
var links = [];
var quotes = [];
var tempUrl = [];
var infos = [];
var firstUrl = 'http://www.imdb.com/search/title?at=0&num_votes=5000,&sort=user_rating,desc&start=1&title_type=tv_infoss';
var file = 'results.csv';
var newUrl;
var x = require('casper').selectXPath;
var fs = require('fs');
String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g, '');}
String.prototype.ltrim=function(){return this.replace(/^\s+/,'');};
String.prototype.rtrim=function(){return this.replace(/\s+$/,'');};
String.prototype.fulltrim=function(){return this.replace(/(?:(?:^|\n)\s+|\s+(?:$|\n))/g,'').replace(/\s+/g,' ');};
Date.prototype.MMDDYYYY = function() {
///
// usage :
// scrape the list - casperjs scrape_mass_court_decisions.js scrape [the number of starting case]
// fetch the detail record - casperjs scrape_mass_court_decisions.js detail [the number of starting case]
// find the missing items - casperjs scrape_mass_court_decisions.js rinse
var casper = require('casper').create();
//var casper = require('casper').create({
// verbose: true,
@Rui-Santos
Rui-Santos / oauth.js
Last active August 29, 2015 14:10 — forked from penk/oauth.js
/*
* oauth.js - Obtain oauth_token from Launchpad.net using Casper.js
* Copyright (c) 2013, Ping-Hsun (penk) Chen <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Usage: casperjs oauth.js <OTP>