Skip to content

Instantly share code, notes, and snippets.

View jaimevalero's full-sized avatar

Jaime Valero jaimevalero

View GitHub Profile
@jaimevalero
jaimevalero / scan-repo-gitleaks.sh
Created September 20, 2021 13:27
using gitleak to scan a github repo
#########Scan a given github url passed as parameter with gitleaks
#eg: REPO=https://github.com/Telefonica/epg-airflow
# Other Param
#SERVER_DESTINO_SSH="github.com"
Scan_Repo()
{
REPO="$1"
import pandas as pd
import pymysql
import matplotlib.pyplot as plt
def get_query(SQL):
con = pymysql.connect(host='MYSQL_REPLACE', user='MYUSUARIO_REPLACE',password='MY_PASSWORD_REPLACE')
return pd.read_sql(SQL , con=con)
def get_table(db,table=""):
"""Return all rows from table """
if (table == "" and "." in db) | (db == "" and "." in table):
@jaimevalero
jaimevalero / execute_jenkins_api_curl_crumb.sh
Last active March 30, 2021 10:31
Execute jenkins jobs using curl and crumb
# Execute a job in jenkins, using api and crumb
# Replace CRED for your credentials and my_jenkins_instance.com with your jenkins instance
CRED=<admin:secret>
# Get crumb
CRUMB=`curl -s --cookie-jar ./cookie -k -u "$CRED" 'https://my_jenkins_instance.com/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)' `
# Execute a job without parameters
curl -k -sS --cookie ./cookie -H $CRUMB 'https://my_jenkins_instance.com/job/test/build' -X POST --user $CRED
@jaimevalero
jaimevalero / extract_user_variables.py
Created August 23, 2020 10:21
Extract user variables in a python session
>>> a=1
>>> b=2
>>> c=3
>>>
>>> # We will extract user variables, filtering those who do not contain '__'
>>>
>>> { k:v for k,v in locals().items() if '__' not in k }
{'a': 1, 'b': 2, 'c': 3}
@jaimevalero
jaimevalero / check_times.sh
Created May 20, 2020 15:55
measure curl times and send it to graphite
[root@prod-epg-icimas-01 plugins]# cat /usr/lib64/nagios/plugins/check_times/check_times.sh
# Measure times and send it to graphite"
# time_appconnect The time, in seconds, it took from the start until the SSL/SSH/etc connect/handshake to the remote host was completed. (Added in 7.19.0)
#
# time_connect The time, in seconds, it took from the start until the TCP connect to the remote host (or proxy) was completed.
#
# time_namelookup The time, in seconds, it took from the start until the name resolving was completed.
#
#! /bin/bash
# script to update jupyter notebooks from command line
#### Environment
git config --global core.mergeoptions --no-edit
DATE=`Actualizado a fecha: date +'%Y-%m-%d %H:%M'`
export GIT_MERGE_AUTOEDIT=no
@jaimevalero
jaimevalero / extract_awesome.sh
Last active May 13, 2023 00:29
Which awesome resource has more awesomess in an awesome list
# Order an awesome list by number stars.
#
# Tis one liner scripts extracts the number of stars from each repo from a given awesome list, and order repos by the number of start
# This one liner uses jq command, so you should have it installed in your machine
# Parameter
# Awesome List to extract, in raw
AWESOME_LIST=https://raw.githubusercontent.com/pditommaso/awesome-pipeline/master/README.md
#CREDENTIALS="jaimevalero:mysecret"
CREDENTIALS="replace-for-your-github-user:replace-for-your-github-password"