Skip to content

Instantly share code, notes, and snippets.

View oliveiraev's full-sized avatar

Evandro Oliveira oliveiraev

View GitHub Profile
@oliveiraev
oliveiraev / linux-to-vagrant.sh
Last active December 25, 2015 19:19
Set up any debian/redhat-based distro ready for vagrant.
test "$(command -v su)" || (echo "su is required but not found" && exit 1)
RUN="su"
test "$(command -v sudo)" && RUN="sudo su"
$RUN -c'
INSTALLER="apt-get"
test "$(command -v yum)" && INSTALLER="yum"
$INSTALLER install -y openssh-server
printf "\n#Vagrant additions\n" >> /etc/sudoers
useradd -s$SHELL vagrant
sed -ri "s/^vagrant:[^:]/vagrant:\!/" /etc/shadow
@oliveiraev
oliveiraev / web2py.sh
Last active December 18, 2015 10:29
Run web2py server whitin a virtualenv/pyenv
#!/usr/bin/env /bin/sh
PIDFILE="web2py.pid"
LOGFILE="web2py.log"
SERVER_NAME="web2py.local"
if [ ! "$1" ]; then
echo 'Usage: {start|stop|restart|status| --web2py params}'
exit 1
fi
#!/bin/bash
if [ ! -d /opt/Sublime* ]; then
if [ ! -f $HOME/Downloads/Sublime*.bz2 ]; then
echo "Ops! You must visit http://www.sublimetext.com/ and download the *.bz2 file to $HOME/Downloads."
exit
else
echo 'Installing Sublime Text...'
sudo mv $HOME/Downloads/Sublime*.bz2 /opt
@oliveiraev
oliveiraev / remove-bom.pl
Last active December 11, 2015 07:19
Check and remove Byte-order-mark. Original here: http://rishida.net/blog/?p=102
# program to remove a leading UTF-8 BOM from a file
# works both STDIN -> STDOUT and on the spot (with filename as argument)
if ($#ARGV > 0) {
print STDERR "Too many arguments!\n";
exit;
}
my @file; # file content
my $lineno = 0;
<!DOCTYPE HTML>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form action="" method="get">
<fieldset>
<legend>Busca de CEP do Correio Control</legend>
@oliveiraev
oliveiraev / download_tweets.sh
Created June 20, 2012 16:41
Baixa todos os tuítes de um usuário com timeline pública
#!/bin/bash
if [ ! -d './downloaded_tweets' ]; then
mkdir downloaded_tweets
if [ ! -d './downloaded_tweets' ]; then
echo "Can't create output dir." > /dev/stderr
exit 1
fi
fi
cd downloaded_tweets
@oliveiraev
oliveiraev / Makefile
Created May 29, 2012 18:32
Setup for fresh new Ubuntu-based installations
ifdef SUDO_USER
USER=$(SUDO_USER)
endif
INSTALL=apt-get install -y
INSTALL_LIB=$(INSTALL) lib$(1)-dev
REMOVE = \
apt-get purge -y $(1)*; \
<!DOCTYPE HTML>
<html lang="pt-Br">
<head>
<meta charset="UTF-8">
<title></title>
<style>
table {
border: none;
}
@oliveiraev
oliveiraev / cookie.js
Created September 20, 2011 16:08
Cookie Handler and manager
@oliveiraev
oliveiraev / FizzBuzzLite.php
Created July 18, 2011 18:46
Smallest FizzBuzz that I can do
<?php
for($i = 1; $i <= 100; $i++){
$print = $i % 3 ? 'Fizz' : '';
if($i % 5) $print .= 'Buzz';
echo '<p>'.(empty($print) ? $i : $print).'</p>';
}