View backup-k8s-secrets.sh
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
mkdir -p /tmp/backup | |
cd /tmp/backup | |
# Only backup "opaque" secrets | |
# (not those for service accounts, etc). | |
# | |
# To back up them all, use the following query: | |
# kubectl get secrets -o json | jq -r '.items[].metadata.name' | |
for secret in $(kubectl get secrets -o json | jq -r '.items[] | select(.type == "Opaque") | .metadata.name'); do | |
echo "Backing up ${secret}..." |
View reminder-about-openstack.sh
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
# Setup several SSH keys to be used with a VM | |
cat << EOF > /path/to/cloud-init.file | |
#cloud-config | |
ssh_authorized_keys: | |
- <public key 1> | |
- <public key 2> | |
EOF | |
# Create the VM (with the minimum set of options) | |
openstack server create \ |
View reminder-about-ova.sh
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/sh | |
# Let's assume you have an OVF image exported from VMWare | |
# (the *.ovf descriptor, *.vmdk, *.mf and *.nvram files) | |
# that you want to deploy on Openstack. | |
# An OVA file is a TAR archive that wraps all this file structure. | |
BASE_NAME="sample" | |
tar -cf "${BASE_NAME}.ova" "${BASE_NAME}.ovf" "${BASE_NAME}.mf" "${BASE_NAME}-1.vmdk" |
View reminder-about-tcpmon.sh
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/sh | |
# Assuming we have an Elastic Search cluster secured by Nginx. | |
################# | |
# On the server. | |
################# | |
# Capture HTTP traffic to Nginx (listening on port 9200). | |
# Output the result in a PCAP file, readable with Wireshark. |
View compose-graylog.yml
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
# Based on https://hub.docker.com/r/graylog/graylog/ | |
# Date: dec. 2018 | |
version: '2' | |
services: | |
# MongoDB: https://hub.docker.com/_/mongo/ | |
mongo: | |
image: mongo:3 | |
# Elasticsearch: https://www.elastic.co/guide/en/elasticsearch/reference/5.5/docker.html | |
elasticsearch: | |
image: docker.elastic.co/elasticsearch/elasticsearch:6.5.1 |
View allInOne.groovy
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
// In vars/allInOne.groovy (shared library that defines the generic pipeline) | |
def call(Map config) { | |
node { | |
def timeStamp = Calendar.getInstance().getTime().format('YYYYMMdd-hhmmss', TimeZone.getTimeZone('Europe/Paris')) | |
def buildId = "${config.imageVersion}-${timeStamp}" | |
stage('Checkout') { | |
echo "Checking out the sources..." | |
checkout scm |
View download-batch-for-linux.sh
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 | |
# Configuration | |
DL_DIR="/wherever/you/want" | |
INPUT="/wherever/is/your/file" | |
# We need "youtube-dl" (https://github.com/rg3/youtube-dl). | |
# We here download the best video quality. | |
# One Youtube address per line. Empty lines are ignored. | |
mkdir -p $DL_DIR && cd $DL_DIR |
View Dockerfile
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
# Based on https://github.com/wernight/docker-kubectl | |
# Both kubectl and helm are available when we launch the image (docker run -ti this-image). | |
# The best option would be mounting the ".kube/config" file as a volume. | |
FROM wernight/kubectl:1.5.3 | |
# Install Helm | |
USER root | |
RUN cd /home \ | |
&& curl https://storage.googleapis.com/kubernetes-helm/helm-v2.2.3-linux-amd64.tar.gz -o helm.tar.gz \ | |
&& tar -xvf helm.tar.gz \ |
View JSonBindingUtils.java
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
import java.io.IOException; | |
import java.util.Collection; | |
import java.util.HashMap; | |
import java.util.Iterator; | |
import java.util.Map; | |
import java.util.Objects; | |
import java.util.Set; | |
import com.fasterxml.jackson.core.JsonGenerator; | |
import com.fasterxml.jackson.core.JsonParser; |
View DelayedInstallationOfTargetHandlerTest.java
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
package whatever; | |
import static org.ops4j.pax.exam.CoreOptions.mavenBundle; | |
import static org.ops4j.pax.exam.CoreOptions.systemProperty; | |
import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.configureSecurity; | |
import java.io.ByteArrayOutputStream; | |
import java.io.File; | |
import java.io.PrintStream; | |
import java.security.PrivilegedActionException; |
NewerOlder