Skip to content

Instantly share code, notes, and snippets.

View missinglink's full-sized avatar

Peter Johnson missinglink

View GitHub Profile
#!/bin/bash
cd /scripts/
sudo ./wifi.sh mon
sudo ./hack.sh kick 00:1B:11:EF:49:94 00:24:36:b5:e7:3d 20
sudo ./wifi.sh man
sudo ./wifi.sh scan
sudo ./wifi.sh scan
sudo ./wifi.sh scan
sudo ./wifi.sh scan
@missinglink
missinglink / lscron.sh
Created May 3, 2013 13:54
List all users' crontab (run as root) Note: This does not include scripts in /etc/cron.hourly, /etc/cron.daily, etc
for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done
var child = require('child_process'),
util = require('util'),
netstat = child.spawn('netstat', ['-nb']),
out = ''
netstat.stdout.on('data', function(data) {
out += data
})
netstat.stderr.on('data', function(data) {
console.log('err: ' + data)
@missinglink
missinglink / skimlinks-product.js
Created May 29, 2013 16:07
Skimlinks Product
@missinglink
missinglink / tradeboubler-product.js
Created May 29, 2013 16:07
Tradedoubler Product
{
"products":[
{
"sourceProductId":"12-113-4917",
"name":"Tradedoubler Concert Ukulele",
"description":"This Concert Size Ukulele is part of the exciting range of premium-uniquely featured high grade series Ukuleles designed for the most professional and aspiring of musicians.",
"productUrl":"http://www.tradedoubler.com/products/12-113-4917/",
"productImage":{
"url":"http://www.tradedoubler.com/products/12-113-4917/images/main.jpg",
"width":500,
@missinglink
missinglink / teco-cats.md
Created June 10, 2013 13:36
Tesco - List Product Categories

List Product Categories

Generated: Mon Mar 18 2013 16:44:39 GMT+0000 (GMT)

Request

{
  "protocol": "https:",
  "host": "www.techfortesco.com",
  "method": "GET",
  "port": 443,
@missinglink
missinglink / elasticfilter.sh
Created June 20, 2013 16:43
Example of mapping field names during a river update
$ curl -XPUT "localhost:9200/_river/mongoscriptfilter/_meta" -d'
{
"type": "mongodb",
"mongodb": {
"db": "testmongo",
"collection": "documents",
"script": "ctx.document.title = ctx.document.title_from_mongo; delete ctx.document.title_from_mongo;"
},
"index": {
"name": "testmongo",
@missinglink
missinglink / installation.md
Last active December 20, 2015 03:19
Working example of how to set up elasticsearch so that the _percolate index is being populated via a mongodb river. Tested with mongodb 2.4.4+, elasticsearch 0.9.0+, elasticsearch-river-mongodb 1.6.11

Configure mongo for replication

  • Make sure you have sufficient disk space to hold the oplog ( can be several GB )
  • Edit /etc/mongodb.conf to add replSet = rs0
  • Restart mongodb
  • In the mongo REPL execute rs.initiate() ( this can take some time; log shows activity )
  • Try executing a query, your REPL prompt should now be rs0:PRIMARY>

MongoDB documentation: http://docs.mongodb.org/manual/tutorial/convert-standalone-to-replica-set/

@missinglink
missinglink / prices.regexp.js
Last active April 15, 2021 14:05
Extract price information from any page using regex stolen from this annoying superfish script.
var regexp = /(([\$\£\€\u20AC]|eur|ils|rs)\.?\s*(<[^>]+>|&nbsp;|\s)?([0-9]+[\,\.])?[0-9]+([\,\.][0-9]+)?)|(([0-9]+[\,\.])?[0-9]+([\,\.][0-9]+)?)(<[^>]+>|&nbsp;|\s|\s\,\-\s)?(€|\u20AC|eur|ils|rs)\.?/ig;
document.body.innerHTML.match(regexp);
@missinglink
missinglink / 0_reuse_code.js
Created October 20, 2013 11:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console