Skip to content

Instantly share code, notes, and snippets.

View luizrobertofreitas's full-sized avatar

Luiz Roberto Freitas luizrobertofreitas

View GitHub Profile
@luizrobertofreitas
luizrobertofreitas / sublime_find_replace.txt
Created October 13, 2022 17:19
Sublime Text: find snake_case and replace to camelCase
Find for regex: _([a-z])
Replace to: \U$1
@luizrobertofreitas
luizrobertofreitas / get_repos.rb
Created January 7, 2022 11:57 — forked from kruszczynski/get_repos.rb
Github GraphQL query for repos, their topics, and Gemfile
require 'httparty'
def get_data
query = File.open('repos.graphql', 'r').read
token = 'https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/'
cursor = nil
repos = []
org = 'evil_mega_corp'
loop do
@luizrobertofreitas
luizrobertofreitas / change-jdk
Last active December 7, 2021 11:50
Change jdk script
#!/bin/bash
versions=(8 11)
if [ $# -eq 0 ]
then
echo "No arguments supplied. exiting"
exit 1
fi
@luizrobertofreitas
luizrobertofreitas / gist:0cb6347385ae39fa7d7441edb46f066a
Created September 24, 2019 19:28
Openshift DSL imagestreamtag exists
pipeline {
agent any
environment {
def imageStreamTagExists = false
}
stages {
stage('Image stream tag') {
steps {
@luizrobertofreitas
luizrobertofreitas / jenkins-pipeline-script-getuserpass
Created August 13, 2019 15:55
Jenkins pipeline groovy script to get user and pass of an existing Jenkins credential
pipeline {
agent none
stages {
stage('First') {
steps{
script{
withCredentials([usernamePassword(credentialsId: 'credentialId', usernameVariable: 'username', passwordVariable: 'token')]) {
print 'token.collect { it }=' + token.collect { it }
print 'username.collect { it }=' + username.collect { it }
}
@luizrobertofreitas
luizrobertofreitas / mysql-docker.sh
Created August 12, 2019 14:23 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@luizrobertofreitas
luizrobertofreitas / NodeJS10Dockerfile.centos7
Created July 29, 2019 17:38
NodeJS 10 Dockerfile for Openshift Jenkins Slaves
FROM openshift/jenkins-slave-base-centos7
USER root
RUN curl -skL -o nodejs-bin.tar.xz https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz && \
tar -xf nodejs-bin.tar.xz && \
mv node-v10.16.0-linux-x64 /opt/nodejs
RUN ln -sf /opt/nodejs/bin/node /usr/local/bin/node && \
ln -sf /opt/nodejs/bin/npm /usr/local/bin/npm && \
@luizrobertofreitas
luizrobertofreitas / nginx.conf
Created May 10, 2019 13:32 — forked from morhekil/nginx.conf
Full request/response body logging in nginx
http {
log_format bodylog '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" $request_time '
'<"$request_body" >"$resp_body"';
lua_need_request_body on;
set $resp_body "";
body_filter_by_lua '
1. Viewing branches diff with meld:
https://stackoverflow.com/questions/2006032/view-differences-of-branches-with-meld
git config --global diff.tool meld
File by File:
git difftool master..devel
Directory view:
git difftool -d master..devel
@luizrobertofreitas
luizrobertofreitas / gist:f99c9589dc038868e756b70f790dd2c4
Created February 22, 2019 03:28
Wierd LocalDateTime when using spring-boot < 2.0.0
1. On pom.xml
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.9.8</version>
</dependency>
2. On application.properties