Skip to content

Instantly share code, notes, and snippets.

View eugenehp's full-sized avatar
🏦
DeepTech, FinTech, BioTech, Robotics, SEO.

Eugene Hauptmann eugenehp

🏦
DeepTech, FinTech, BioTech, Robotics, SEO.
View GitHub Profile
@eugenehp
eugenehp / node-chrome
Created June 26, 2012 13:46
Node.js spawn and control Google Chrome
var express = require('express');
var cp = require('child_process');
var app = express.createServer();
var chrome_count = 0;
app.get('/', function(req, res){
startChrome(chrome_count++,9222,function chromeStared(err,id,chrome){
res.send('Chrome '+id+' Started\r\n');
@eugenehp
eugenehp / api.v1.html
Created June 26, 2012 15:37
Sample HTML POST form for API for scrapper
<form action="http://localhost:3000/api/v1" method="post">
<p>Your url here</p>
<input id="url"
style="width:800px"
type="text" value="'http://www.patrickhyundai.com/browse-new-hyundais.aspx'"/>
<br>
<p>jQuery Selector</p>
<textarea name="selector" style="width:400px;height:100px">
var s = [];
@eugenehp
eugenehp / index.js
Created July 5, 2012 05:55
Chrome scrapper
var express = require('express');
var cp = require('child_process');
var Chrome = require('./lib/chrome');
var Remote = require('./lib/remote');
var app = express.createServer();
app.use(express.bodyParser());
app.use(app.router);
app.use(express.static(__dirname + '/public'));
@eugenehp
eugenehp / reverse-ip-lookup.js
Created July 8, 2012 14:58
node.js IP reverse lookup
var dns = require('dns');
function reverseLookup(ip) {
dns.reverse(ip,function(err,domains){
if(err!=null) callback(err);
domains.forEach(function(domain){
dns.lookup(domain,function(err, address, family){
console.log(domain,'[',address,']');
console.log('reverse:',ip==address);
@eugenehp
eugenehp / arin.txt
Created July 8, 2012 15:14
Sample ARIN output
telnet whois.arin.net 43
Trying 199.71.0.46...
Connected to whois.arin.net.
Escape character is '^]'.
n 213.46.228.196
#
# The following results may also be obtained via:
# http://whois.arin.net/rest/nets;q=213.46.228.196?showDetails=true&showARIN=false&ext=netref2
#
@eugenehp
eugenehp / arin.js
Created July 8, 2012 15:55
ARIN check library
var net = require('net');
var ARIN = function(ip,keyword,callback){
var arin = {
port: 43,
host: 'whois.arin.net'
};
var client = net.connect(arin.port,arin.host);
@eugenehp
eugenehp / ripe.js
Created July 8, 2012 17:17
RIPE check library
//https://apps.db.ripe.net/whois/search.json?query-string=213.46.228.196&source=ripe
var net = require('net');
var RIPE = function(ip,keyword,callback){
var arin = {
port: 43,
host: 'whois.ripe.net'
};
var client = net.connect(arin.port,arin.host);
@eugenehp
eugenehp / rules.js
Created July 8, 2012 19:02
How to make a multiple rules
var rules = [
{
reverse: 'upclive.nl',
arin: 'Amsterdam',
ripe: 'upc'
},
{
reverse: 'upclive.nl',
arin: 'Amsterdam',
ripe: 'upc'
@eugenehp
eugenehp / gist:3089594
Created July 11, 2012 10:45
Sample output from ec2-184-169-203-225.us-west-1.compute.amazonaws.com
{"data":["http://www.patrickhyundai.com/new-hyundais/2012/Hyundai/Genesis/KMHGC4DF4CU160872/H30197.aspx","http://www.patrickhyundai.com/new-hyundais/2012/Hyundai/Genesis/KMHGC4DF6CU187846/H31467.aspx","http://www.patrickhyundai.com/new-hyundais/2012/Hyundai/Genesis/KMHGC4DF5CU166261/H30727.aspx","http://www.patrickhyundai.com/new-hyundais/2012/Hyundai/Genesis/KMHGC4DD9CU181392/H31171.aspx","http://www.patrickhyundai.com/new-hyundais/2012/Hyundai/Genesis/KMHGC4DD2CU198101/H31732.aspx","http://www.patrickhyundai.com/new-hyundais/2011/Hyundai/Genesis/KMHGC4DF5BU145134/H20888.aspx","http://www.patrickhyundai.com/new-hyundais/2012/Hyundai/Genesis/KMHGC4DD0CU167283/H30322.aspx","http://www.patrickhyundai.com/new-hyundais/2012/Hyundai/Genesis/KMHGC4DD9CU167279/H30323.aspx","http://www.patrickhyundai.com/new-hyundais/2012/Hyundai/Genesis/KMHGC4DD6CU167000/H30320.aspx","http://www.patrickhyundai.com/new-hyundais/2012/Hyundai/Genesis/KMHGC4DD7CU152683/H30034.aspx","http://www.patrickhyundai.com/new-hyundais/2012/Hyunda
@eugenehp
eugenehp / gist:3146980
Created July 19, 2012 21:33
emulating Command-K keyboard event
CGEventRef eventCommandK = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)40, true);
CGEventSetFlags(eventCommandK, kCGEventFlagMaskCommand);
CGEventPost(kCGSessionEventTap, eventCommandK);