Skip to content

Instantly share code, notes, and snippets.

View jjaniec's full-sized avatar
☁️
Staring at the clouds 👽

Joffrey Janiec jjaniec

☁️
Staring at the clouds 👽
  • revolve.team / lexisnexis.fr / 42.fr
  • Paris
View GitHub Profile
@jjaniec
jjaniec / jenkins_get_permissions_map_from_config_xml.sh
Last active November 3, 2021 16:19
Convert a roleMap (xpath /hudson/authorizationStrategy/roleMap) from a jenkins config.xml file to a yaml compatible with JCasC
#!/bin/bash
#set -o xtrace
# Usage: $0 ./path-of-config.xml
getxml() { # $1 = xml file, $2 = xpath expression
echo "cat $2" | xmllint --shell $1 |\
sed -n 's/[^\"]*\"\([^\"]*\)\"[^\"]*/\1/gp'
}

Keybase proof

I hereby claim:

  • I am jjaniec on github.
  • I am jjaniec (https://keybase.io/jjaniec) on keybase.
  • I have a public key whose fingerprint is 1DEC E5B2 4F57 689B D378 285E 5C1C 29AE 37A4 CE7C

To claim this, I am signing this object:

@jjaniec
jjaniec / jenkins_parse_plugin_list.sh
Last active July 16, 2021 09:46
Fetch plugin list from jenkins plugins directory
#!/bin/bash
set -o verbose
set -o pipefail
set -o errexit
set -o nounset
cd plugins
rm plugins.txt || true
@jjaniec
jjaniec / k8s-service-account-kubeconfig.sh
Created April 21, 2020 07:59
Create kubeconfig file from in-cluster pod with a serviceaccount
#!/bin/bash -ex
# Usage ./k8s-service-account-kubeconfig.sh ( namespace ) ( service account name )
TEMPDIR=$( mktemp -d )
trap "{ rm -rf $TEMPDIR ; exit 255; }" EXIT
SA_SECRET=$( kubectl get sa -n $1 $2 -o jsonpath='{.secrets[0].name}' )
# Configuration for telegraf agent
[agent]
## Default data collection interval for all inputs
interval = "10s"
## Rounds collection interval to 'interval'
## ie, if interval="10s" then always collect on :00, :10, :20, etc.
round_interval = true
## Telegraf will send metrics to outputs in batches of at most
## metric_batch_size metrics.