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 / avconv_examples.sh
Last active November 12, 2016 16:39
avconv command lines to reduce video size
# https://trac.ffmpeg.org/wiki/Encode/H.264
# https://trac.ffmpeg.org/wiki/Encode/AAC
# -map 0 -c copy: copy all remaining streams
# -pix_fmt yuv420p: be compatible with most players
# high quality video, high quality audio
avconv -i input.mov -map 0 -c copy -c:v libx264 -preset veryslow -pix_fmt yuv420p -crf 17 -c:a libfdk_aac -vbr 4 output.mov
# high quality *compatible* full-hd video, high quality audio
@romuloceccon
romuloceccon / md5check.cmd
Last active August 29, 2015 14:20
Check md5 against a given file list (Windows)
rd /q /s md5check_temp
xcopy /e /i /h X:\ md5check_temp
md5deep64.exe -lrX md5sum.txt md5check_temp\
@romuloceccon
romuloceccon / pybackup.cmd
Last active August 29, 2015 14:20
Backup utility with replication for Windows
DEL /q ..\tmp\*.*
"C:\Program Files\Python 2.7\python.exe" pybackup.py >> ..\logs\pybackup.log 2>&1
@romuloceccon
romuloceccon / start-ssh-agent.sh
Created May 18, 2015 13:25
Starts ssh-agent from bashrc, preventing multiple instances between sessions
#! /bin/bash
AGENTPID=$HOME/.ssh/agent.pid
AUTHSOCK=$HOME/.ssh/auth.sock
if [[ -z ${SSH_AUTH_SOCK+x} ]]
then
if [[ ! -e $AUTHSOCK || ! -e $(cat $AUTHSOCK) ]]
then
eval $(ssh-agent -s)
@romuloceccon
romuloceccon / google-maps.txt
Last active February 19, 2016 21:36
Google maps urls
Terrain + roads
https://www.google.com.br/maps/vt?lyrs=p&x=2569&y=4639&z=13&scale=1
https://www.google.com.br/maps/vt?lyrs=p&x=5139&y=9279&z=14&scale=1
https://www.google.com.br/maps/vt?lyrs=p&x=10278&y=18558&z=15&scale=1
Birdeye + roads
https://www.google.com.br/maps/vt?lyrs=y&x=2569&y=4639&z=13&scale=1
https://www.google.com.br/maps/vt?lyrs=y&x=5139&y=9279&z=14&scale=1
@romuloceccon
romuloceccon / git-current-lines-by-author.sh
Last active April 30, 2018 09:58
git stats by author
git ls-files -z | xargs -0n1 git blame -e | perl -e 'while (<>) { s/^.*?<(.*?)>.*$/\1/; print $_; }' | sort -f | uniq -c | sort -n
@romuloceccon
romuloceccon / Gemfile
Last active April 24, 2016 13:21
Redis tests
gem 'redis'
gem 'json'
@romuloceccon
romuloceccon / init_ssh_user.sh
Last active June 24, 2016 16:24
Initialize the .ssh dir of a user using credentials from another user (with root privileges)
# Copy and paste the following lines into a shell replacing $1 with the actual username.
# It will then ask for the public key to initialize the .ssh dir.
# The key will be appended to the authorized_keys file; current content (if any) will be preserved.
U=$1 ; H=$(eval echo ~$U) ; sudo mkdir -p $H/.ssh \
&& echo "Paste ssh key: (end with ^D)" \
&& cat > /tmp/$U_key.pub \
&& cat /tmp/$U_key.pub | sudo tee -a $H/.ssh/authorized_keys > /dev/null \
&& rm /tmp/$U_key.pub \
&& sudo chown $U:$U $H/.ssh \
@romuloceccon
romuloceccon / app_file_touched.rb
Created July 2, 2016 19:43
God condition to monitor files using inotify
module God
module Conditions
class AppFileTouched < TriggerCondition
def initialize
super
@mutex = Mutex.new
@queue = []
@condition = ConditionVariable.new
@thread = nil
end
require 'csv'
CSV do |out|
csv = CSV.new(STDIN)
csv.each do |row|
out << row.map do |x|
if m = x.match(/^\d+$/)
(m[0].to_i * 1.6).round.to_s
elsif m = x.match(/^(\d+)( m)(.*)$/)
(m[1].to_i * 1.6).round.to_s + ' km' + m[3]