Skip to content

Instantly share code, notes, and snippets.

View roberto-filho's full-sized avatar

Roberto Welzel Filho roberto-filho

View GitHub Profile
@katta
katta / mvncolor.sh
Created June 15, 2011 18:50
Script to add colors to maven output
#!/usr/bin/env bash
# Formatting constants
export BOLD=`tput bold`
export UNDERLINE_ON=`tput smul`
export UNDERLINE_OFF=`tput rmul`
export TEXT_BLACK=`tput setaf 0`
export TEXT_RED=`tput setaf 1`
export TEXT_GREEN=`tput setaf 2`
export TEXT_YELLOW=`tput setaf 3`
@rstacruz
rstacruz / index.md
Last active November 3, 2023 09:56
Rails models cheatsheet

Rails Models

Generating models

$ rails g model User

Associations

belongs_to

has_one

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@ralfstx
ralfstx / comp-repo.sh
Created June 8, 2012 10:16
Tool to maintain p2 composite repositories
#!/bin/bash
#
# Tool to maintain p2 composite repositories
USAGE="Usage:
`basename "$0"` <repo-dir> [options] operation, operation ...
Options:
--name <repo name>
the repository name
--eclipse <eclipse install dir>
@antonio
antonio / delete_rebased_and_merged_branches.sh
Created January 21, 2013 14:58
Delete branches that were rebased (reference never updated) and merged into master
#!/bin/sh
for branch in $(git branch -a | sed 's/^\s*//' | sed 's/^remotes\///' | grep -v 'master$'); do
last_commit_msg="$(git log --oneline --format=%f -1 $branch)"
if [[ "$(git log --oneline --format=%f | grep $last_commit_msg | wc -l)" -eq 1 ]]; then
if [[ "$branch" =~ "origin/" ]]; then
local_branch_name=$(echo "$branch" | sed 's/^origin\///')
if [[ -n "$EXEC" ]]; then
git push origin :$local_branch_name
else
@roberto-filho
roberto-filho / server.sh
Last active December 26, 2015 05:09 — forked from luizkowalski/server
sudo ip addr add 192.168.0.183/24 dev eth0 #Configura o ip
ip route add default via 192.168.0.106 #Configura o proxy
sudo ip link set dev eth0 up #Sobe a interface
# Verificar o arquivo /etc/resolv.conf, deve conter as seguintes linhas
nameserver 8.8.8.8
nameserver 8.8.4.4
#Subir o postgres
su - postgres #Loga como superuser postgres
@aldrinleal
aldrinleal / Sample POM
Created February 25, 2014 11:04
Bootstrap pom for JBake Stuff
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.tasafo</groupId>
<artifactId>yoursite</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<properties>
<hostname>yoursite.com</hostname>
@fappel
fappel / DisplayHelper.java
Last active January 4, 2017 05:32
JUnit 4 TestRule to ease SWT Display Tests (Dependencies: JUnit, SWT, Guava)
import static com.google.common.collect.Iterables.toArray;
import static com.google.common.collect.Lists.newLinkedList;
import static java.util.Arrays.asList;
import java.util.Collection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.junit.rules.TestRule;
@lttlrck
lttlrck / gist:9628955
Created March 18, 2014 20:34
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@roberto-filho
roberto-filho / drop-users.sql
Created March 25, 2014 12:31
Query para dropar todos os usuários de uma base especificada pela query
SELECT pg_terminate_backend(pg_stat_activity.procpid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = 'gruberdev'
AND procpid <> pg_backend_pid();