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
git remote add <other-fork-alias> <other-fork-URL> | |
git checkout <branch> | |
git fetch <other-fork-alias> | |
git cherry-pick <commit-hash> | |
git push <your-fork-alias> | |
git remote remove <other-fork-alias> | |
git remote -v |
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 | |
# | |
# DESCRIPTION: | |
# | |
# Set the bash prompt according to: | |
# * the active virtualenv | |
# * the branch of the current git/mercurial repository | |
# * the return value of the previous command | |
# | |
# USAGE: |
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
KEY=XXXXXXXXXXXX | |
HOST="https://metrics.crisidev.org" | |
mkdir -p dashboards && for dash in $(curl -k -H "Authorization: Bearer $KEY" $HOST/api/search\?query\=\& |tr ']' '\n' |cut -d "," -f 5 |grep slug |cut -d\" -f 4); do | |
curl -k -H "Authorization: Bearer $KEY" $HOST/api/dashboards/db/$dash > dashboards/$dash.json | |
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
#!/bin/bash | |
# Source arguments from Ansible | |
# These are passed into the module as $1 with a key=value format | |
# Sourcing this file sets the variables defined in the Ansible module | |
# Note that variables that are unused in the module are silently ignored | |
source $1 | |
# Helper function to fail the module with the specified error | |
# This can accept $@ in printf for the full error |
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
### Generic Dockerfile demonstrating good practices | |
### Imports | |
# Bad-ish, we do not need Ubuntu for this, nor do we want latest if we are using in a build system, predictable is better | |
FROM ubuntu:latest | |
# Better, using a small image since our app has no dependency on Ubuntu | |
FROM alpine:3.3 |
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
node { | |
echo 'No quotes in single backticks' | |
sh 'echo $BUILD_NUMBER' | |
echo 'Double quotes are silently dropped' | |
sh 'echo "$BUILD_NUMBER"' | |
echo 'Even escaped with a single backslash they are dropped' | |
sh 'echo \"$BUILD_NUMBER\"' | |
echo 'Using two backslashes, the quotes are preserved' | |
sh 'echo \\"$BUILD_NUMBER\\"' | |
echo 'Using three backslashes still results in preserving the single quotes' |
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 python | |
import json | |
import rethinkdb as r | |
from os import environ as env | |
HOST = env.get('RETHINK_HOST', '127.0.0.1') | |
PORT = env.get('RETHINK_PORT', 28015) | |
DB = env.get('RETHINK_DB', 'inventory') | |
GROUP = env.get('RETHINK_GROUP', 'dev') |