Skip to content

Instantly share code, notes, and snippets.

View spectra's full-sized avatar

Pablo Lorenzzoni spectra

View GitHub Profile
@spectra
spectra / fapt.sh
Created December 8, 2015 19:21
Parallel downloading for apt-get
#!/bin/bash
NBATCH=3
NPARALLEL=5
(apt-get -y --print-uris $@ | egrep -o -e "http://[^\']+" | xargs -r -l${NBATCH} -P${NPARALLEL} wget -nv -P "/var/cache/apt/archives/") && apt-get $@
@spectra
spectra / git-tear.sh
Created October 1, 2015 19:23
Extract a git directory as a separated project
#!/bin/bash
SUBDIR=$1
if [ "$SUBDIR" = "" ]; then
echo "You have to enter a subdir as first arg"
exit -1
fi
if [ ! -e $SUBDIR ]; then
echo "$SUBDIR must exist. Are you in the repo root?"
@spectra
spectra / change_author.sh
Last active October 1, 2015 19:27
Change the author name/email of a single commit
#!/bin/bash
# Change the Author Name/Email of a single commit
git filter-branch --commit-filter '
if [ "$GIT_COMMIT" = "commit-hash-here" ]; then
GIT_AUTHOR_NAME="New Author Name";
GIT_AUTHOR_EMAIL="New Author Email";
git commit-tree "$@";
else
git commit-tree "$@";
@spectra
spectra / gamdelete.rb
Last active August 29, 2015 14:03
Gmail All Mail periodic deletion
#!/usr/bin/env ruby
# Delete files from Gmail All Mail folder
# Needs proper Gmail account configuration
#
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (commit 34973274ccef6ab4dfaaf86599792fa9c3fe4689):
# <pablo@propus.com.br> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return Pablo Lorenzzoni
# ----------------------------------------------------------------------------
@spectra
spectra / mjpeg-server.sh
Last active August 29, 2015 14:03
Simple MJPEG Server
#!/bin/bash
# Simple MJPEG Server
# ----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (commit 34973274ccef6ab4dfaaf86599792fa9c3fe4689):
# <pablo@propus.com.br> wrote this file. As long as you retain this notice you
# can do whatever you want with this stuff. If we meet some day, and you think
# this stuff is worth it, you can buy me a beer in return Pablo Lorenzzoni
# ----------------------------------------------------------------------------
# MJPEG Stream frame
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@spectra
spectra / qemu-debian-create-image
Last active June 30, 2017 13:18
Debian qemu image creation using debootstrap (automated from http://diogogomes.com/2012/07/13/debootstrap-kvm-image/ by Kamil Trzcinski (http://ayufan.eu) with some modifications by me)
#!/bin/bash
# Configs
VSYSTEM=qemu # Either 'qemu' or 'kvm'
INCLUDES='less,vim,sudo,openssh-server,acpid'
MIRROR="http://ftp.br.debian.org/debian"
ARCH=686
clean_debian() {
[ "$MNT_DIR" != "" ] && chroot $MNT_DIR umount /proc/ /sys/ /dev/ /boot/
@spectra
spectra / SantaTrans.bas
Last active January 1, 2016 07:19
Just a bunch of LibreOffice macros to ease my report reviews at the hospital.
' SantaTrans
' Transformations for a standardized Santa Casa PACS reports
' Really just a bunch of snippets put together
' -----------------------------------------------------------------------------
' "THE BEER-WARE LICENSE" (commit 34973274ccef6ab4dfaaf86599792fa9c3fe4689):
' <pablo@lorenzzoni.org> wrote this file. As long as you retain this notice you
' can do whatever you want with this stuff. If we meet some day, and you think
' this stuff is worth it, you can buy me a beer in return. Pablo Lorenzzoni
' -----------------------------------------------------------------------------
@spectra
spectra / gist:138791
Created July 1, 2009 13:58
Technical versus Non-Technical talks at FISL10
spectra@harad:~$ wget -q -O /dev/stdout http://fisl.softwarelivre.org/10/papers/pub/ | perl -lne '$i++ while m/=.tech_track_[0-9]+/g;END{print $i}'
204
spectra@harad:~$ wget -q -O /dev/stdout http://fisl.softwarelivre.org/10/papers/pub/ | perl -lne '$i++ while m/=.non_tech_track_[0-9]+/g;END{print $i}'
175
spectra@harad:~$