Skip to content

Instantly share code, notes, and snippets.

View fmamud's full-sized avatar
💻

Felipe Mamud fmamud

💻
View GitHub Profile
@fmamud
fmamud / .bash_profile
Created March 2, 2022 12:48 — forked from frnhr/.bash_profile
Show current pyenv python version in bash prompt, and also color virtual envs differently
####
#### pyenv-virtualenv bash prompt customization
####
# pyenv
eval "$(pyenv init -)"
# pyenv-virtualenv:
@fmamud
fmamud / multiple-repository-and-identities-git-configuration.md
Created October 22, 2021 15:45 — forked from bgauduch/multiple-repository-and-identities-git-configuration.md
Git config with multiple identities and multiple repositories

Setup multiple git identities & git user informations

/!\ Be very carrefull in your setup : any misconfiguration make all the git config to fail silently ! Go trought this guide step by step and it should be fine 😉

Setup multiple git ssh identities for git

  • Generate your SSH keys as per your git provider documentation.
  • Add each public SSH keys to your git providers acounts.
  • In your ~/.ssh/config, set each ssh key for each repository as in this exemple:
@fmamud
fmamud / wait.sh
Last active April 26, 2021 14:27
Adding HTTP check
#!/bin/bash
set -e
sleep_seconds=2
function usage() {
echo "Usage: ./wait <tcp/http> <host>:<port>"
}
@fmamud
fmamud / luacc.lua
Last active August 18, 2022 11:02
Lua Dogfood
-- Marc Balmer marc@msys.ch via lists.lua.org
-- $ lua luacc.lua -o luacc luacc.lua
local outfile = 'luacc.out'
local strip = false
for k, v in pairs(arg) do
if v == '-o' then
outfile = arg[k + 1]
arg[k] = ''
@fmamud
fmamud / gradle.build.kts
Last active November 29, 2018 23:41
FatJar with Gradle Kotlin DSL
plugins {
// Apply the Kotlin JVM plugin to add support for Kotlin on the JVM
kotlin("jvm").version("1.3.10")
application
}
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
@fmamud
fmamud / ratpack.groovy
Last active November 4, 2020 14:42
Ratpack simple example that serves first json file found in current directory
@Grab('io.ratpack:ratpack-groovy:1.8.0')
import static ratpack.groovy.Groovy.ratpack
import static ratpack.jackson.Jackson.json
import groovy.json.JsonSlurper
def parser = new JsonSlurper()
ratpack {
handlers {
@fmamud
fmamud / MySpec.groovy
Last active October 27, 2016 02:18
Mock and Spy in Spock Specification
import spock.lang.*
class MySpec extends Specification {
def starshipName = 'NCC-1701'
def "size method should be executed three times"() {
given:
List list = Mock()
when:
@fmamud
fmamud / pom.xml
Created October 14, 2016 21:01
Spock in Maven
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>1.0-groovy-2.4</version>
</dependency>
@fmamud
fmamud / build.gradle
Last active October 14, 2016 21:02
Spock in Gradle
dependencies {
testCompile group: 'org.spockframework', name: 'spock-core', version: '1.0-groovy-2.4'
}
@fmamud
fmamud / MySpec.groovy
Created October 14, 2016 04:59
Stubbing multiple parameters in Spock Specification
import spock.lang.*
class MySpec extends Specification {
def "should return 2 for method parameter equal to 2"() {
given:
List list = Stub()
list.get(0) >> 0
list.get(1) >> { throw new IllegalArgumentException() }
list.get(2) >> 2