Skip to content

Instantly share code, notes, and snippets.

View romuloceccon's full-sized avatar

Rômulo Ceccon romuloceccon

  • Frankfurt am Main, Deutschland
View GitHub Profile
@romuloceccon
romuloceccon / download_all.sh
Last active December 15, 2015 00:39
Downloads photos from a facebook album and builds a simple html page for browsing them.
#!/usr/bin/env bash
TOKEN=$1
ruby fb_album_tool.rb -t $TOKEN -l | while IFS="\|" read -ra LINE; do
mkdir "${LINE[1]}"
cd "${LINE[1]}"
ruby ../fb_album_tool.rb -t $TOKEN -d ${LINE[0]}
cd ..
done
@romuloceccon
romuloceccon / curl_resolve_test.c
Created October 11, 2013 20:36
This example reproduces an issue with curl 7.32 or older: when adding an easy handle which sets CURLOPT_RESOLVE to a multi handle curl will sometimes consider the entry expired and check the default DNS servers instead.
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
#include <curl/curl.h>
size_t write_callback(char *ptr, size_t size, size_t nmemb, void *userdata)
{
return size * nmemb;
}
@romuloceccon
romuloceccon / fetch-flickr-html-codes.rb
Last active December 26, 2015 09:18 — forked from anonymous/fetch-flickr-html-codes.rb
Generates a list of html code blocks for all pictures in a Flickr set.
require 'flickraw'
# 1. Define FLICKR_API_KEY and FLICKR_SHARED_SECRET. Get them at
# http://www.flickr.com/services/api/keys/
# 2. Run `fetch-flickr-html-codes.rb auth` and follow the instructions.
# 3. Run `fetch-flickr-html-codes.rb <token> <secret>` to list all sets.
# 4. Run `fetch-flickr-html-codes.rb <token> <secret> <set_id>` to
# generate the html code blocks of all pictures from the given set
# using the 'Medium' size.
@romuloceccon
romuloceccon / config_application.rb
Created December 4, 2013 13:55
Minimal Rails 4.0.2 application that reproduces an issue where the I18n::Fallbacks module will raise spuriours I18n::InvalidLocale errors where translating an attribute name that does not exist in the translation file.
require File.expand_path('../boot', __FILE__)
require 'rails/all'
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)
module A
class Application < Rails::Application
@romuloceccon
romuloceccon / Makefile
Last active December 31, 2015 06:58
xdelta3 decode test
.PHONY: all
all : xdeltadecode
xdeltadecode : xdeltadecode.o xdelta3.o
gcc -o $@ $^ -llzma
%.o :
gcc -Wall -I /home/romulo/Downloads/xdelta3-3.0.6 -DHAVE_CONFIG_H -DXD3_POSIX=1 -DXD3_USE_LARGEFILE64=1 -DNOT_MAIN -c $^ -o $@
xdeltadecode.o : xdeltadecode.c
description "No-ip client"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
umask 022
expect fork
@romuloceccon
romuloceccon / google_maps.xml
Last active October 4, 2021 19:32 — forked from cmtsij/google.xml
Custom "Google Maps" source (pt-BR) for Mobile Atlas Creator 1.9.16. Save as *.xml in /mapsources.
<customMapSource>
<name>Google Maps</name>
<minZoom>0</minZoom>
<maxZoom>20</maxZoom>
<tileType>PNG</tileType>
<tileUpdate>IfNoneMatch</tileUpdate>
<url>http://mt{$serverpart}.google.com/vt/lyrs=m@176103410&amp;hl=pt-BR&amp;x={$x}&amp;y={$y}&amp;z={$z}&amp;s=Galileo&amp;scale=1</url>
<serverParts>0 1 2 3</serverParts>
</customMapSource>
@romuloceccon
romuloceccon / google_earth.xml
Last active May 25, 2016 09:08
Custom "Google Earth" source for Mobile Atlas Creator 1.9.16. Save as *.xml in /mapsources.
<customMapSource>
<name>Google Earth</name>
<minZoom>0</minZoom>
<maxZoom>19</maxZoom>
<tileType>JPG</tileType>
<tileUpdate>IfNoneMatch</tileUpdate>
<url>https://khms{$serverpart}.google.com/kh/v=154&amp;x={$x}&amp;y={$y}&amp;z={$z}</url>
<serverParts>0 1 2 3</serverParts>
</customMapSource>
#!/bin/bash
IFS=$'\n'
for L in $(git status --porcelain $1); do
if [[ $L =~ ^\ M\ (.*)$ || $L =~ ^\ T\ (.*)$ || $L =~ ^\?\?\ (.*)$ ]] ; then
git add ${BASH_REMATCH[1]}
>&2 echo added ${BASH_REMATCH[1]}
elif [[ $L =~ ^\ D\ (.*)$ ]] ; then
git rm ${BASH_REMATCH[1]}
@romuloceccon
romuloceccon / .gitignore
Last active April 3, 2025 19:04
A .gitignore file for tracking the /etc directory with git
*~
*-old
*.cache
*.dpkg-dist
*.dpkg-bak
/*-
/*.org
/adjtime
/.pwd.lock
/mtab