Skip to content

Instantly share code, notes, and snippets.

View fabiojose's full-sized avatar
🎯
Focusing

Fabio Jose fabiojose

🎯
Focusing
  • São Paulo, Brazil
  • 13:19 (UTC -03:00)
View GitHub Profile
@fabiojose
fabiojose / replication-controller.feature
Last active November 22, 2017 19:25
Feature wrote in Gherkin
Feature: Replication Controller
As a user of Openshift PaaS
I want to query Pods managed by a replication controller
So I will get all of then running and with a right setup
Scenario: All pods are running
Given I am logged in Openshift as "developer"
And access to "oss-pre" namespace
When query the pods of "apigateway" replication controller
Then all pods managed by "apigateway" replication controller should have the status equals to "running"
@fabiojose
fabiojose / replication-controller.js
Last active November 22, 2017 19:35
Steps implementation for cucumber.js
const defineSupportCode = require("cucumber").defineSupportCode;
let exec = require("child_process").exec;
let fs = require("fs");
let openshift_password = process.env.OPENSHIFT_PASSWORD || "developer";
let openshift_url = process.env.OPENSHIFT_URL || "https://127.0.0.1:8443";
let build_id = process.env.BUILD_NUMBER || "1";
let build_name = process.env.JOB_NAME || "cucumber";
@fabiojose
fabiojose / move.sh
Created December 19, 2017 11:38
Git move repo to another
git clone --mirror <URL to my OLD repo location>
cd <New directory where your OLD repo was cloned>
git remote set-url origin <URL to my NEW repo location>
git push -f origin
@fabiojose
fabiojose / nifi_merge_json.groovy
Last active March 6, 2018 19:12
Apache NIFI - ExecuteScript - Merge JSON
import org.apache.nifi.processor.FlowFileFilter
import groovy.json.JsonSlurper
import groovy.json.JsonBuilder
//get first flow file
def ff0 = session.get()
if(!ff0)return
//get project_name
def project_name = ff0.getAttribute('project_name')
@fabiojose
fabiojose / Jenkinsfile.groovy
Created March 16, 2018 12:48
Jenkinsfile fragment to send metrics to InfluxDB
script {
/* Custom data map for InfluxDB */
def custom = [:]
custom['branch'] = env.GIT_BRANCH
custom['environment'] = target /*Target environment: DEV | PRE | PRO*/
custom['part'] = 'jenkins'
custom['version'] = version /*Package version*/
/* Push metrics to InfluxDB, including all default and the custom data*/
step([$class: 'InfluxDbPublisher', customData: custom, target: 'devops-kpi'])
@fabiojose
fabiojose / git.sh
Created March 27, 2018 20:06
git special commands
# Shows the last commit stats
git show -1 --stat
#OR
git log -1 --stat
# Shows all commit stats
git log -1 --stat
# Shows for the last commmit just the stats per file
git log -1 --numstat --format='%H'
@fabiojose
fabiojose / gitlog.json
Created April 1, 2018 14:55
git log in json
[
{
"hash":"10ef79ff1720aa5179373871ee58b08674e5c420",
"author":"Fábio J. Moraes",
"email":"fabiojose@gmail.com",
"timestamp":"1510082724",
"changes":"4",
"insertions":"38",
"deletions":"15"
},
@fabiojose
fabiojose / skip.c
Last active October 25, 2018 00:16
Implementação de SkipList em linguagem C (C99)
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
/**
* Definindo a porcentagem de changes para
* executação do laço que cria o nível do nó.
* Nesse caso, 50% de chance que o laço executará uma vez.
*/
Operating system Docker implementation
Linux Default docker daemon for OS
macOS Docker for macOS
macOS Docker Toolbox
Windows Docker for Windows
Windows Docker Toolbox
@fabiojose
fabiojose / new.sh
Last active November 13, 2018 13:24
mvn archetype:generate \
-DarchetypeGroupId=org.apache.maven.archetypes \
-DarchetypeArtifactId=maven-archetype-archetype \
-DarchetypeVersion=1.3