Skip to content

Instantly share code, notes, and snippets.

@jobou363
jobou363 / bitbucketClone.ps1
Last active February 17, 2023 14:20
Powershell script to git clone or fetch all team project from bitbucket
# the purpose of the script was to do a backup of all the repositories in a bitbucket team locally
# you can add this script in a scheduler daily or a teamcity build get a backup locally of all source code
# the following script connect to bitbucket.org to get all team repositories
# it does a foreach to clone new repository or fetch, pull existing one
# use auth2 to get a token
# https://developer.atlassian.com/cloud/bitbucket/oauth-2/
# adapt the following script by
# 1- connect to your bitbucket account and create an auth consumer Key:Secret, give the read access to the project
# 2- create also an app password
@pkuczynski
pkuczynski / parse_yaml.sh
Last active April 9, 2024 18:36
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}