This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env groovy | |
/* | |
* Runs shell command and prints back stdout and stderr | |
*/ | |
command='ls -al' | |
println new ProcessBuilder('sh','-c',command).redirectErrorStream(true).start().text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Creates Jenkins credentials with username and password, | |
# made for Harbor Robot Accounts, but can be used for any username/password json file | |
# @author thabet.amer@gmail.com | |
# @since Jenkins 2.222.1 | |
# @params json file with {"name":"","token":""} tags | |
# @output Jenkins credential with ID name "harbor-NAME" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
aws ecr get-login --no-include-email | sh | |
# to read the authentication string only, so it can be used in apps. | |
#aws ecr get-authorization-token --output text --query 'authorizationData[].authorizationToken' --region eu-central-1 \ | |
# | base64 -d | cut -d: -f2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- alert: container_down | |
expr: absent(container_last_seen{job="cadvisor",name="rabbitmq"}) | |
for: 30s | |
labels: | |
severity: critical | |
annotations: | |
summary: "Container down" | |
description: "{{ $labels.instance }} {{ $labels.name }} container is down for more than 30 seconds." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"annotations": { | |
"list": [ | |
{ | |
"builtIn": 1, | |
"datasource": "-- Grafana --", | |
"enable": true, | |
"hide": true, | |
"iconColor": "rgba(0, 211, 255, 1)", | |
"name": "Annotations & Alerts", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Returns host IP for AWS EC2 | |
curl http://169.254.169.254/latest/meta-data/public-ipv4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWS_BUCKET="xyz" | |
AWS_REGION="eu-central-1" | |
AWS_ID="11111111111" | |
AWS_USER="s3-user" | |
# TODO: review access | |
cat > policy.json << EOL | |
{ | |
"Version": "2012-10-17", | |
"Id": "Policy1554206237047", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# Runs Jnekins in Docker container. | |
# TODO: auto add plugins and default configs. | |
# Logs customization from https://hub.docker.com/_/jenkins/ | |
mkdir data | |
cat > data/log.properties <<EOF | |
handlers=java.util.logging.ConsoleHandler | |
jenkins.level=FINEST | |
java.util.logging.ConsoleHandler.level=FINEST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Either to compile single file passed in args | |
# OR to go over all .tex files in directory - in batch mode. | |
# compile the tex file in arguments | |
[ -f "$1" ] && { docker run -i -w "/doc" -v "$PWD":/doc thomasweise/texlive xelatex -interaction=nonstopmode -halt-on-error $1; exit 0; } | |
# batch mode - compile all tex files | |
docker run -i -w "/doc" -v "$PWD":/doc thomasweise/texlive bash -c 'for file in $(find . -maxdepth 1 -name "*.tex"); do echo "Generating pdf for $file ..." && xelatex -interaction=batchmode -halt-on-error $file; done' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# installs gems then serves web on http://0.0.0.0:4000 | |
# | |
## you may want to exclude vendor/bundle in _config.xml | |
# | |
## For Github pages, refer to https://pages.github.com/versions/ to find supported Jekyll version | |
## as in your Gemfile. | |
# | |
export JEKYLL_VERSION=3.8.5 | |
docker run --rm -it \ | |
-v "$(pwd):/srv/jekyll" \ |