Skip to content

Instantly share code, notes, and snippets.

View phgeraldeli's full-sized avatar

Philippe Geraldeli Araujo phgeraldeli

View GitHub Profile
@phgeraldeli
phgeraldeli / generate.sh
Created February 26, 2023 15:38
Generate single index with HTML Reports for GitLab CI + GitLab Pages
#!/bin/bash
# Define the HTML header and footer
header="<html><head><title>HTML Reports</title>
<style>
.topnav {
position: fixed;
top: 0;
left: 0;
width: 100%;
@phgeraldeli
phgeraldeli / get_jobs_with_text.sh
Created June 28, 2021 17:17
Get Jobs with specific log
String saida = new ProcessBuilder( 'sh', '-c','''
find ./jobs/ -name log | xargs grep -sl "xxxxxxxxxxx" | rev | cut -d '/' -f 4- | rev | uniq
''').redirectErrorStream(true).start().text
println( saida )
#!/bin/bash
# Get all group owners from gitlab
MY_ACCESS_TOKEN=$1
curl -s --location --request GET 'http://gitlab.intranet/api/v4/groups' --header "PRIVATE-TOKEN: ${MY_ACCESS_TOKEN}" -o file.txt
grep -Po '"id":\d+' file.txt | cut -d: -f2 > ids.txt
grep -Po 'web_url":[^,]+' file.txt > names.txt
for X in $(cat ids.txt); do
# Algoritmo de Dijkstra
import heapq
n = 1
m = 1
while(n != 0 and m != 0):
n, m = input().split() # ler numero de vertices e arestas
n = int(n)
@phgeraldeli
phgeraldeli / nexus_clean_unused_images.py
Created January 8, 2021 13:54
Clean unused docker images in the past x days
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# python2.7
# ORIGINAL: https://gist.github.com/anjia0532/4a7fee95fd28d17f67412f48695bb6de
from requests import Request, Session
from requests.exceptions import RequestException
from datetime import datetime,timedelta
import urllib3
@phgeraldeli
phgeraldeli / credential.groovy
Created January 8, 2021 13:47
Jenkins credentials discover
// Execute in jenkins script console
String saida = new ProcessBuilder( 'sh', '-c','''
grep -A4 CredentialName credentials.xml | tail -1 | cut -d'>' -f2 | cut -d'<' -f1
''').redirectErrorStream(true).start().text
saida = saida.replaceAll('\\s','')
println( saida )
println( hudson.util.Secret.decrypt(saida) )