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 (lparravi@gmail.com)
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
#!/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/
# lparravi@gmail.com
@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 / 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
@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;
//
// 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
#!/usr/bin/env ruby -W
require 'yaml'
require 'fileutils'
#
# Copies a physics shape from a sprite (reading it's .meta file)
# and aplies the same shape to other sprites.
# Tested only with .meta files created with Unity 2019.1.0f2 and MY
@luisparravicini
luisparravicini / anim.sh
Last active April 12, 2020 14:32
ffmpeg options added to make twitter accept the video
#!/bin/bash
#
# Takes a directory of macOS screemshots, label each file with
# a timestamp and creates a video with them.
#
dir=$1