Skip to content

Instantly share code, notes, and snippets.

Rodrigo Fernandes rtfpessoa

Block or report user

Report or block rtfpessoa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rtfpessoa
rtfpessoa / npm-install.sh
Last active Jan 24, 2016
NPM install OSX
View npm-install.sh
#!/bin/bash
#
# Correct way to install NPM and Node.js on OS X
# Credits: https://gist.github.com/DanHerbert/9520689
#
rm -rf /usr/local/lib/node_modules
brew uninstall node npm
brew install node --without-npm
@rtfpessoa
rtfpessoa / docker-sg-command.sh
Last active Jan 10, 2016
Docker group change without reload shell
View docker-sg-command.sh
#!/bin/bash
# Execute docker command without need to kill shell after changing groups
sudo userdel docker || echo "Success"
sudo groupdel docker || echo "Success"
sudo groupadd -g 2004 docker
sudo adduser --disabled-password --gecos "" --uid 2004 --gid 2004 docker
sudo gpasswd -a docker docker
sudo gpasswd -a $USER docker
sudo su -c 'sudo service docker restart' -s /bin/bash $USER
@rtfpessoa
rtfpessoa / .gitconfig
Last active Dec 31, 2015
git Configuration
View .gitconfig
#
# rtfpessoa git Configuration
#
# core {{{
[core]
editor = /usr/bin/nano
pager=less -x4
quotepath = false
# excludesfile = /Users/rtfpessoa/.gitignore
@rtfpessoa
rtfpessoa / partial-function-tupled.scala
Last active Nov 23, 2015
Partially apply function with tuple
View partial-function-tupled.scala
def t(a: Int, b : Int, c : Int) = a + b + c
t(1, _: Int, _: Int)
t.tupled.apply((2, 3))
@rtfpessoa
rtfpessoa / LittleTree.scala
Created Nov 14, 2015
LittleTree Implementation
View LittleTree.scala
package com.rtfpessoa.scala
import scala.language.postfixOps
import scala.util.Properties
case class LittleTree(height: Int) {
implicit class IntOps(int: Int) {
def isOdd = int % 2 > 0
}
View remove-running-pid.sh
#!/bin/bash
#
# Remove RUNNING_PID on PlayFramework applications
#
for DOCKER in $(docker ps -a -q --filter "name=codacy_"); do
docker stop $DOCKER
docker start $DOCKER
docker exec -it $DOCKER rm RUNNING_PID
@rtfpessoa
rtfpessoa / name-redefenition.scala
Last active Oct 6, 2015
Scala can be weirdly dangerous
View name-redefenition.scala
object NameReDef {
def withWrapper(foo: String => String) = {
println("Wrapping ...")
foo("My pretty string")
}
def bar = {
withWrapper { str =>
// Does not compile if we use the str above before the re-definition
// println("Defined:")
@rtfpessoa
rtfpessoa / count-lines.sh
Last active Sep 29, 2015
Line counter dummy script
View count-lines.sh
#!/bin/bash
EXTENSION=$1
FILE_COUNT=0
LINE_SUM=0
for FILE in $(find . -type f -iname "*.$EXTENSION")
do
NUM_LINES=$(cat $FILE | wc -l)
NUM_LINES=${NUM_LINES%% }
@rtfpessoa
rtfpessoa / ZipUtils.scala
Last active Sep 25, 2015
Zip Utils Scala Wrapper
View ZipUtils.scala
import java.util.zip.{ZipEntry, ZipFile, ZipOutputStream}
import better.files._
import scala.collection.JavaConversions.enumerationAsScalaIterator
import scala.language.existentials
import scala.util.{Properties, Try}
object ZipUtils {
View Solarized-Dark-Yosemite.terminal
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPEB8w
LjAzMTM3MjU0OTAyIDAuMTYwNzg0MzEzNyAwLjIAEAGAAtIQERITWiRjbGFzc25hbWVY
JGNsYXNzZXNXTlNDb2xvcqISFFhOU09iamVjdF8QD05TS2V5ZWRBcmNoaXZlctEXGFRy
You can’t perform that action at this time.