Skip to content

Instantly share code, notes, and snippets.

Chmouel Boudjnah chmouel

Block or report user

Report or block chmouel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View j.sh
j () {
local root=~/GIT/go/src/github.com/
local res results args
while getopts "np" opt
do
if [[ $opt = "?" ]]
then
print -r -- "$myname: unrecognized option: -$OPTARG" >&2
return 1
fi
View _odo.zsh
_odo () {
local target url username password logged admin t i addusername colortarget=green
export EXTRA_PROMPT=""
if [[ $1 == "-n" ]]
then
addusername=yes
shift
fi
if [[ $1 == "-k" ]]
then
View decode-kubernetes-secrets.py
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
# Author: Chmouel Boudjnah <chmouel@chmouel.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
View ghprefix.sh
#!/bin/bash
titleonly=
if [[ $1 == "-t" ]];then
titleonly=t
fi
title=$(osascript -e 'tell application "Firefox" to return name of windows as text')
number=$(echo $title|gsed -r 's/.* Issue #([0-9]+) .*/\1/;')
[[ ${title} =~ .*Issue\ \#[0-9]{3,} ]] || { echo "I could not find a github Issue ###"; exit 1;}
if [[ ${titleonly} ]];then
@chmouel
chmouel / gbs.sh
Last active Jun 5, 2019
Choose branch with FZF including preview diff with bat
View gbs.sh
chosen=$(git branch --sort=-committerdate --format '%(refname:short)' -l|grep -v heads/|fzf --border --preview "git log --no-merges --patch-with-stat {}|bat --language=diff --color=always" --bind CTRL-P:preview-up,CTRL-N:preview-down,CTRL-SPACE:preview-page-down --preview-window=up:80%)
[[ $1 == -n ]] && { echo $chosen ; return ;}
git checkout ${chosen}
View tekton-showlog.sh
#!/bin/bash
set -e
choosef() {
type="$1"
[[ -n $2 ]] && label="-ltekton.dev/${2}"
[[ -n $3 ]] && jqb=$3 || jqb='.items[].metadata.name'
kubectl get ${type} ${label} -o json|jq -r $jqb | fzf -1
}
PIPELINE=$(choosef pipeline)
View tkn-pr-status.sh
#!/bin/bash
set -e
SED=sed;type -p gsed >/dev/null 2>/dev/null && SED=gsed #osx blah
JOB_NAME=${1-pull-tekton-pipeline-integration-tests}
JOB_URL=$(hub ci-status -v| sed -n "/${JOB_NAME}/ { s/.*https/https/;p;}")
rm -f /tmp/.prjtlogs${JOB_NAME}.* # Cleanups
TMP=$(mktemp /tmp/.prjtlogs${JOB_NAME}.XXXXXX)
@chmouel
chmouel / tekton-pull-from-ci-push-to-release.bash
Last active May 4, 2019
docker pull image from openshift ci and push to quay openshift-pipeline
View tekton-pull-from-ci-push-to-release.bash
set -ex
v=${1}
[[ -z ${v} ]] && {
echo "You need a release number i.e: 0.3.1"
}
for p in bash controller creds-init entrypoint git-init kubeconfigwriter nop webhook;do
docker pull registry.svc.ci.openshift.org/openshift/knative:tektoncd-pipeline-${p}
docker tag registry.svc.ci.openshift.org/openshift/knative:tektoncd-pipeline-${p} quay.io/openshift-pipeline/tektoncd-pipeline-$p:v${v}
@chmouel
chmouel / yaml2json.sh
Created Apr 24, 2019
Convert yaml to json via the command line
View yaml2json.sh
#!/usr/bin/env bash
[[ -n $1 ]] && from=$1 || from=/dev/stdin
python3 -c 'import sys, yaml, json; json.dump(yaml.load(sys.stdin), sys.stdout, indent=4);print()' < ${from} | jq '.'
@chmouel
chmouel / os4-install.bash
Last active Apr 25, 2019
install openshift 4 in loop
View os4-install.bash
#!/usr/bin/env bash
# set -x
set -e
SD=$(readlink -f $(dirname $0))
IC=$(readlink -f $(dirname $0)/install-config.yaml )
DIR=${SD}/os4
function recreate() {
You can’t perform that action at this time.