Skip to content

Instantly share code, notes, and snippets.

Avatar
🌴
On vacation

abdennour abdennour

🌴
On vacation
View GitHub Profile
@abdennour
abdennour / Dockerfile
Created Jun 27, 2020
Encrypt tar gz file in Dockerfile
View Dockerfile
FROM alpine:3.12
RUN apk add --update --no-cache openssl
WORKDIR /src
COPY . .
WORKDIR /dest
ARG KEY
ENV KEY=${KEY}
# compress them &&
RUN tar -C /src -cvzf clear.tgz . &&\
openssl enc -aes-256-cbc -in clear.tgz -out notclear.tgz.enc -pass env:KEY && \
@abdennour
abdennour / config.yaml
Created Jun 16, 2020
Seed Job for Declarative Pipelines with Bitbucket
View config.yaml
projects:
- name: PROJA
owner: myteam
repositories:
- name: kito
- name: bito
- name: IDEAS
owner: myteam
repositories:
- name: ideas
View Jenkinsfile.groovy
pipeline {
agent any
stages {
stage('Build') {
parallel {
stage("build-ui") {
agent {
@abdennour
abdennour / offline_pull_images
Created May 28, 2020
Offline Cluster 1 - Pull images from the proxy registry
View offline_pull_images
#!/bin/bash
echo "If you want to make quay.io/coreos/flannel:v0.11.0-amd64 available in the machine :"
echo "- Example Run : ${0} quay.io/coreos/flannel/v0.11.0-amd64"
echo "- Example Run : ${0} myapp-pod.yaml "
echo "- Example Run : ${0} http://some.thing/myapp-pod.yaml "
private_registry=${2}
regex_remote='^(https?|ftp)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]\.[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]$'
@abdennour
abdennour / ReadVaultSecret.groovy
Last active May 21, 2020
Jenkins steps for vault
View ReadVaultSecret.groovy
#!/usr/bin/env groovy
def call(body){
def config = [:]
body.resolveStrategy = Closure.DELEGATE_FIRST
body.delegate = config
body()
def splited = config.secretPath.split('@')
def chartPath = config.chartPath
@abdennour
abdennour / haskell.js
Last active May 21, 2020
Mimic Haskell with Javascript in Functional Programming and Composition
View haskell.js
function _(...fns) {
return x => fns.reverse().reduce((reduced, f ) => f(reduced), x )
}
const sum = arr => arr.reduce((a, b) => a + b, 0 )
const filter = (fn, arr) => arr === undefined ? b => filter(fn, b) : arr.filter(fn)
// export
View add-repo-to-nexus.sh
for i in {1..4}; do
f=.nexus-init/0${i}.json
curl -vX POST -u admin:admin123 \
http://localhost:8081/service/rest/beta/repositories/maven/proxy \
-d @${f} -H "Content-Type: application/json"
done
@abdennour
abdennour / ubuntu-vnc-desktop.sh
Created Apr 8, 2020
Install Ubuntu Desktop with VNC
View ubuntu-vnc-desktop.sh
#!/bin/bash
sudo apt-get update -y
sudo apt-get install ubuntu-desktop -y
sudo apt-get install tightvncserver -y
sudo apt-get install gnome-panel gnome-settings-daemon -y
sudo apt-get install metacity nautilus gnome-terminal gnome-shell -y
# sudo apt-get install ubuntu-gnome-desktop -y
cat > ~/.vnc/xstartup <<EOF
#!/bin/sh
export XKL_XMODMAP_DISABLE=1
@abdennour
abdennour / 00-vault-up.sh
Last active Feb 20, 2020
Vault up and Operations
View 00-vault-up.sh
cat vault.hcl
# create data container which holds the hcl file
docker create -v /config --name config busybox; docker cp vault.hcl config:/config/;
docker exec -it config cat /config/vault.hcl
docker run -d --name consul -p 8500:8500 consul:v0.6.4 agent -dev -client=0.0.0.0
docker run -d --name vault-dev --link consul:consul -p 8200:8200 --volumes-from config cgswong/vault:0.5.3 server -config=/config/vault.hcl
# docker run -d --name vault-dev --volumes-from config --cap-add=IPC_LOCK -e 'VAULT_LOCAL_CONFIG={"backend": {"file": {"path": "/config/vault.hcl"}}, "default_lease_ttl": "168h", "max_lease_ttl": "720h"}' --link consul:consul vault server
@abdennour
abdennour / convert.sh
Created Feb 1, 2020
Convert a DER file (.crt .cer .der) to PEM
View convert.sh
# Convert a DER file (.crt .cer .der) to PEM
openssl x509 -inform der -in certificate.cer -out certificate.pem