Skip to content

Instantly share code, notes, and snippets.

View ivansabik's full-sized avatar

Iván ivansabik

  • Texas
View GitHub Profile
@ivansabik
ivansabik / cnsf.js
Last active August 29, 2015 14:18
Script Node.js para checar si ya se publicó la convocatoria del premio CNSF 2015 y enviar mail de alerta
// HTTP a http://www.cnsf.gob.mx/Eventos/Paginas/Premios_2015.aspx
// Si el header de respuesta es distinto de 200, ignorar
// Si es 200 enviar mail
var nodemailer = require('nodemailer');
var smtpTransport = require('nodemailer-smtp-transport');
var request = require('request');
var URL = 'http://www.cnsf.gob.mx/Eventos/Paginas/Premios_2015.aspx';
var USER = '';
@ivansabik
ivansabik / xrayPhantomExample.njs
Last active March 21, 2017 18:58
Phantom with x-ray example
var xray = require('x-ray');
var phantom = require('x-ray-phantom');
var URL = 'http://www.yad2.co.il/Nadlan/rent.php?City=%D7%99%D7%A8%D7%95%D7%A9%D7%9C%D7%99%D7%9D&Neighborhood=&HomeTypeID=11&fromRooms=1&untilRooms=&fromPrice=200&untilPrice=&PriceType=1&FromFloor=&ToFloor=&EnterDate=&Info=';
xray(URL)
.use(phantom())
.select([{
$root: 'body',
tds: ['td']
@ivansabik
ivansabik / cronScriptExample.php
Last active August 29, 2015 14:12
Command line periodic script with PHP
#!/usr/bin/php
<?php
while(true) {
sleep(5);
echo 'aufgewacht' . PHP_EOL;
}
?>
@ivansabik
ivansabik / csv_split.sh
Created June 9, 2014 15:39
Split CSV to multiple files with Shell script
#!/bin/bash
tail -n +2 CONSO.txt | split -l 20000000 - split_
for file in split_*
do
head -n 1 CONSO.txt > tmp_file
cat $file >> tmp_file
mv -f tmp_file $file
done