Skip to content

Instantly share code, notes, and snippets.


Gustavo Franke gustavofranke

View GitHub Profile
  • list local configs: git config --list
  • create a branch: git branch testing, testing is the branch name
  • point to a branch: git checkout testing git checkout master
  • create and point to a branch: git checkout -b testing
  • list of current branches: git branch
  • merge: git checkout master ; git merge testing
  • delete a branch: git branch -d testing
  • to point a local copy to a different url: git remote set-url origin
  • to revert all changes to be just like remote repository head: git fetch origin && git reset --hard origin/master

I just had to set up Jenkins to use GitHub. My notes (to myself, mostly):

Detailed Instructions

For setting up Jenkins to build GitHub projects. This assumes some ability to manage Jenkins, use the command line, set up a utility LDAP account, etc. Please share or improve this Gist as needed.

Install Jenkins Plugins

gustavofranke / Linux
Last active Apr 18, 2016
Basic use cases of cmd line programs
View Linux


Filter by file extension: grep -r --include \*.java <the-expression> .

Recursive Find and Replace

find ./ -type f -readable -writable -exec sed -i 's/this/by that/g' {} ;

  • Ctrl + a – go to the start of the command line
  • Ctrl + e – go to the end of the command line
  • Ctrl + k – delete from cursor to the end of the command line
  • Ctrl + u – delete from cursor to the start of the command line
  • Ctrl + w – delete from cursor to start of word (i.e. delete backwards one word)
  • Ctrl + y – paste word or text that was cut using one of the deletion shortcuts (such as the one above) after the cursor
  • Ctrl + xx – move between start of command line and current cursor position (and back again)
  • Alt + b – move backward one word (or go to start of word the cursor is currently on)
  • Alt + f – move forward one word (or go to end of word the cursor is currently on)
  • Alt + d – delete to end of word starting at cursor (whole word if cursor is at the beginning of word)
gustavofranke /
Created Feb 5, 2016
Singleton with Enum in Java
import org.junit.Test;
import static org.junit.Assert.*;
public class MyTest {
public void shouldReturnASDF() {
assertEquals("asdf", MySingleton.INSTANCE.asdf());
gustavofranke / curry.scala
Created Feb 17, 2017
playing with curryfied functions
View curry.scala
val z: Int => Int = _ + 1
val y = z(3)
val x = z
val sum: (Int, Int) => Int = _ + _
val sumCurried: Int => Int => Int = sum.curried
val w = sumCurried(1)
View scala-try-type.scala
import scala.util.Try
val a = Try(5 / 0)
a.recoverWith { case _ Try(1) }
View traits-basic.scala
trait Bird {
val name: String
trait Flying {
def flyMessage: String
def fly() = println(flyMessage)
trait Swimming {
View reverse-string.scala
def rev[A](str: List[A]): List[A] = str match {
case Nil => Nil
case x :: Nil => x :: Nil
case x :: y :: Nil => y :: x :: Nil
case x :: xs => xs.last +: rev(xs.init) :+ x
val gus = "Gustavo".toList //gus: List[Char] = List(G, u, s, t, a, v, o)
rev(gus) //res0: List[Char] = List(o, v, a, t, s, u, G)
gustavofranke /
Last active Jan 27, 2018
implicit examples
//////// Implicit parameter
def giveMeAnInt(implicit i: Int) = i
implicit val someInt: Int = 42
def makeString(i: Int): String = s"makeString: ${i.toString}"