Skip to content

Instantly share code, notes, and snippets.

View rpherrera's full-sized avatar

Rafael de Paula Herrera rpherrera

  • Octa6
  • Toronto, ON - Canada
View GitHub Profile
@rpherrera
rpherrera / timezone-Sao_Paulo.sh
Created October 18, 2012 18:43
Updates the Sao_Paulo Timezone (2012..2016) and does some basic checking after that
#!/bin/bash
# Updates the Sao_Paulo Timezone (2012..2016) and does some basic checking after that
echo -n 'Checking for zic: '
which zic &>/dev/null
if [ ${?} -eq 0 ]
then
echo -ne 'OK\n'
else
@rpherrera
rpherrera / timezone-Sao_Paulo.zic
Created October 18, 2012 18:46
Sao_Paulo Time Zone for years 2012..2016 which you can build on top of zic compiler
Rule Brazil 2012 only - Feb 26 00:00 0 S
Rule Brazil 2012 only - Oct 21 00:00 1 D
Rule Brazil 2013 only - Feb 17 00:00 0 S
Rule Brazil 2013 only - Oct 20 00:00 1 D
Rule Brazil 2014 only - Feb 16 00:00 0 S
Rule Brazil 2014 only - Oct 19 00:00 1 D
Rule Brazil 2015 only - Feb 22 00:00 0 S
Rule Brazil 2015 only - Oct 18 00:00 1 D
Rule Brazil 2016 only - Feb 21 00:00 0 S
@rpherrera
rpherrera / timezone_inserts.py
Created October 19, 2012 00:56
Inserts a record every second, so we could see if the MySQL internal engine could deal smootly with that when transition occours
#!/usr/bin/python
# -*- coding: utf-8 -*-
import MySQLdb as mdb
import sys
from time import sleep
class TimedInsert:
@rpherrera
rpherrera / mysql-timezone-setup.sh
Created October 19, 2012 20:24
Import /etc/localtime to MySQL and set its TimeZone to SYSTEM
#!/bin/bash
user='root'
password='default'
mysql_bin='mysql'
function set_up_bin() {
if [ "${user}" == "" ]; then
@rpherrera
rpherrera / .screenrc
Created January 24, 2013 18:32
A simple .screenrc to put on servers
altscreen on
term screen-256color
bind ',' prev
bind '.' next
hardstatus alwayslastline
hardstatus string '%{= kG}%-Lw%{= kW}%50> %n%f* %t%{= kG}%+Lw%< %{= kG}%-=%c:%s%{-}'
@rpherrera
rpherrera / makebib.perl
Created January 27, 2013 03:22
Plain Text to BibTeX references converter. Taken from: http://www.snowelm.com/~t/doc/tips/makebib.perl Original post: http://www.snowelm.com/~t/doc/tips/makebib.en.html
#!/usr/bin/perl -T
# $Id: makebib.perl,v 1.18 2006/02/06 05:34:04 t Exp $
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@rpherrera
rpherrera / swappy.sh
Last active August 29, 2015 14:10 — forked from jdowning/swappy.sh
#!/usr/bin/env bash
## Usage: swappy [-t|--total]
## Identify the processes that use swap
# Usage
test "$1" = "-h" -o "$1" = "--help" && {
grep '^##' <"$0" | cut -c4-
exit 2
}
@rpherrera
rpherrera / config
Last active August 29, 2015 14:10 — forked from jtriley/config
# This is an example config that assumes tagger.py is either in
# $HOME/.starcluster/plugins or lives somewhere in your $PYTHONPATH
[plugin tagger]
setup_class = tagger.TaggerPlugin
# add as many key=value pairs as you like separated by ','
tags = 'mykey=myvalue, mykey2=myvalue2'
[cluster default]
...
@rpherrera
rpherrera / dockviz-containers-images.sh
Created January 15, 2015 19:12
docker dockviz view containers images gnome
#!/bin/bash
# Install dockviz:
# https://github.com/justone/dockviz
# You can import it from .bashrc with the following commands (assuming you saved this script in '~/bin':
# echo ". ~/bin/dockviz-containers-images.sh" >>~/.bashrc
# source ~/.bashrc
function dockviz_containers() {
@rpherrera
rpherrera / get-opencv-flags-format-cmake
Created January 20, 2015 16:53
All OpenCV 2.4.10 Flags and Format for CMake
##########################
### ONLY 'OCV_OPTION's ###
##########################
# Getting OpenCV Flags
curl https://raw.githubusercontent.com/Itseez/opencv/2.4.10/CMakeLists.txt | grep -i OCV_OPTION | cut -d'(' -f2 | awk '{print $1}'
# Getting OpenCV Flags and Formatting for CMake
curl https://raw.githubusercontent.com/Itseez/opencv/2.4.10/CMakeLists.txt | grep -i OCV_OPTION | cut -d'(' -f2 | awk '{print $1}' | xargs -I XXX echo "-D XXX=OFF \\"