Skip to content

Instantly share code, notes, and snippets.

View luisparravicini's full-sized avatar

Luis Parravicini luisparravicini

View GitHub Profile
@luisparravicini
luisparravicini / inscribir.rb
Created June 5, 2009 23:28
Inscripcion automatica al torneo diario de elbruto.es
#!/usr/bin/ruby
#
# Inscribe a un jugador de elbruto.es a los torneos.
#
# El nombre del jugador y la clave se definen en conf.yaml
#
# escrito por Luis Parravicini ([email protected])
require 'yaml'
@luisparravicini
luisparravicini / jquery.twitter.js
Created October 3, 2009 15:25
Use Twitter api with JQuery to update news on a web page
/*
jquery twitter. By Luis Parravicini.
http://ktulu.com.ar/blog/2009/10/03/twitter-updates-with-jquery/
*/
(function($) {
$.twitter_updates = function(options) {
var defaults = { 'count': 10 }
var opts = $.extend(defaults, options)
var elem = this
@luisparravicini
luisparravicini / DumpIndex.java
Created October 12, 2009 14:40
Dumps a Lucene index as a XML document.
import java.io.File;
import java.io.IOException;
import java.util.List;
import javax.xml.stream.FactoryConfigurationError;
import javax.xml.stream.XMLOutputFactory;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamWriter;
import org.apache.lucene.document.Document;
@luisparravicini
luisparravicini / isbn_search.rb
Created December 11, 2009 20:54
Busca la informacion de un libro segun su isbn
#!/usr/bin/ruby1.9.1
# Script para traducir isbn a informacion del libro buscando en varias
# librerias online. Se probo por ultima vez el 2009-12-11.
#
# Author:: Luis Parravicini
# Copyright:: Copyright (C) 2009 Luis Parravicini
# License:: GPL v2
#
# http://ktulu.com.ar/blog/2009/12/11/traduciendo-isbn/
#!/usr/bin/ruby1.9.1
#
# Reads the next line from a file and tweets it. It saves the position
# of the last line read so successive executions will use different
# lines of text. Authentication info is read from a file with YAML.
#
# http://ktulu.com.ar/blog/2010/05/07/twiteos-automaticos/
# [email protected]
@luisparravicini
luisparravicini / uncrush.rb
Created October 31, 2011 17:13
Revert optimizations made on .png files for iOS and leave them on their corresponding directory (if all the png are in a single dir, use pngcrush -d instead).
require 'fileutils'
include FileUtils
$dir = ARGV.shift
if $dir.nil?
puts "usage: #{$0} <dir>"
exit 1
end
Dir.glob("#{$dir}/**/*.png").each do |path|
@luisparravicini
luisparravicini / composite.rb
Created March 25, 2012 13:47
Compose several images using ImageMagick
require 'fileutils'
include FileUtils
dir = ARGV.shift
method = ARGV.shift
if dir.nil? || method.nil?
puts "usage #{$0} <image-dir> <method>"
exit 1
end
@luisparravicini
luisparravicini / copy_assets.rb
Created September 4, 2012 20:58
Combine image assets in different sizes (for iPhone/iPad) into a single directory using cocos2d sufixes
require 'fileutils'
include FileUtils
#
# Copy images from a directory hierarchy like this:
#
# dir/
# 320x480/
# 640x480/
# 1024x768/
@luisparravicini
luisparravicini / screenshots.rb
Last active December 21, 2015 11:18
Takes a screenshot every 5 seconds and save the file to a certain folder passed as argument (works on OS X)
#!/usr/bin/env ruby
#
# Takes a screenshot every 5 seconds and save the file to a certain folder passed as argument.
# It uses screencapture, which comes with OS X.
#
#
require 'fileutils'
include FileUtils
//
// Tries to decode all the files on a certain directory and outputs the result:
// System.out for the files with a qr code
// System.err for the files without a qr code
//
// based on code from https://stackoverflow.com/questions/36210537/find-qr-code-in-image-and-decode-it-using-zxing
//
// needs the ZXing jars from:
// https://oss.sonatype.org/content/repositories/snapshots/com/google/zxing/core/3.3.4-SNAPSHOT/core-3.3.4-20181025.133109-2.jar
// https://oss.sonatype.org/content/repositories/snapshots/com/google/zxing/javase/3.3.4-SNAPSHOT/javase-3.3.4-20181025.133127-2.jar