Skip to content

Instantly share code, notes, and snippets.

View matiasinsaurralde's full-sized avatar

Matias Insaurralde matiasinsaurralde

  • Paraguay
View GitHub Profile
@matiasinsaurralde
matiasinsaurralde / padron
Last active December 16, 2015 11:08
script para obtener los datos del padrón
require 'nokogiri'
require 'net/http'
require 'uri'
require 'cgi'
def data_for(id)
uri, nice_data = URI.parse('http://tsje.gov.py/dinamics/app/consulta-al-padron.php'), {}
http = Net::HTTP.new(uri.host, uri.port); req = Net::HTTP::Post.new(uri.path); req['Host'] = 'tsje.gov.py'; req['Referer'] = 'http://tsje.gov.py/'; req['X-Requested-With'] = 'XMLHttpRequest'; req.set_form_data( { 'cedula' => id }); res = http.request(req); raw_html = res.body; span6_count = 0
@matiasinsaurralde
matiasinsaurralde / extended_category_page.php
Last active December 16, 2015 16:40
Wordpress Custom Page
<?php
/*
Template Name: Extended category
(we want to enable many plugins that do not work with the default category template)
*/
?>
<?php
@matiasinsaurralde
matiasinsaurralde / main.rb
Last active December 17, 2015 23:58
nicpy
#!/usr/bin/env ruby
# encoding: utf-8
require 'net/http'
def find_email(body)
body.scan(Regexp.new(/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\b/)).uniq.first
end
# encoding: utf-8
require 'rest_client'
p RestClient::post( 'http://www.ultimahora.com/_post/sendRecomendar.php',
{ 'nombre' => 'UH',
'email' => 'web@ultimahora.com',
'emailAmigos' => 'alguncorreo@gmail.com',
'mensaje' => '-',
'titulo' => 'Link malicioso',
Dir[ File.join( ARGV[0], '*' ) ].each do |font|
puts "@font-face { font-family: #{font.split('/').last.split('.').first}; src: url('#{font}'); }"
end
# $ ruby font-face-generator.rb fonts/
# @font-face { font-family: Example; src: url('fonts/Example.otf'); }
# @font-face { font-family: AnotherOne; src: url('fonts/AnotherOne.otf'); }
#!/bin/sh
# latest trac!
wget "http://download.edgewall.org/trac/Trac-1.0.1.tar.gz"
tar xf Trac-1.0.1.tar.gz
cd Trac-1.0.1
require 'socket'
require 'base64'
Refresh = 1 # seconds to refresh image on server
screen_capture_command = 'screencapture -C -x tmp.png'
image = ''
latest = Time.now
server = TCPServer.new 3000
loop do
package main
import( "fmt"
"math" )
const x = math.Pi/180
const R = 6371
// robpike: https://twitter.com/mattfarina/status/344151151719104512
require 'nokogiri'
page = Nokogiri::HTML( File.read('teams.html') )
page.xpath("//table[@id='index']/tbody/tr").each do |tr|
tds = tr.xpath(".//td").map { |e| e.inner_text().strip() }
team_name, hack_name, members, team_id = tds[0], tds[1], tds[2], tr.xpath(".//a[position()=1]").attr('href').value.match(/[0-9]+/)[0].to_i
p [team_id, team_name, hack_name, members]
end
@matiasinsaurralde
matiasinsaurralde / uber-twilio.rb
Created August 23, 2014 04:31
uber-twilio.rb
# using a twilio phone number for uber sms verification
require 'rubygems'
require 'twilio-ruby'
require 'sinatra'
get '/' do
twiml = Twilio::TwiML::Response.new do |r|
r.Message 'GO'
end