Skip to content

Instantly share code, notes, and snippets.

View lucacesari's full-sized avatar
🎯
Focusing

Luca Cesari lucacesari

🎯
Focusing
  • RCP Vision
  • Florence (Italy)
View GitHub Profile
@bjoernQ
bjoernQ / app's build.gradle
Created November 5, 2014 08:08
Android/Gradle: Have debug and release variants for a library
...
dependencies {
debugCompile project(path: ':library', configuration: 'debug')
releaseCompile project(path: ':library', configuration: 'release')
}
...
@henrikh
henrikh / only-figures.sh
Created April 15, 2012 06:34
Take all figures from a LaTeX document and make a new document with only them.
#It's a shell script that should work on all Unix systems with pdflatex and pdfpages installed. You use by giving it the file name of the tex file (no .tex ending!) and the offset in pages (caused by front matter) as the second argument:
#
# ./only-figures.sh document 1
#
#
#First we load the .aux and prepare to store it in a variable.
STR=$(cat $1.aux |\
#We only care about the lines with figures.
grep figure |\
#And of these lines we only care about the number referring to unique pages.
@bmarini
bmarini / progress_bar.rb
Created September 14, 2011 21:55
CLI progress bar in ruby
class ProgressBar
def initialize(units=60)
@units = units.to_f
end
def print(completed, total)
norm = 1.0 / (total / @units)
progress = (completed * norm).ceil
pending = @units - progress
Kernel.print "[#{'=' * progress }#{' ' * ( pending )}] #{percentage(completed, total)}%\r"
@esperlu
esperlu / mysql2sqlite.sh
Created April 27, 2011 05:46
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite