Skip to content

Instantly share code, notes, and snippets.

View cicorias's full-sized avatar

Shawn Cicoria cicorias

View GitHub Profile
@cicorias
cicorias / docker-compose-npm-install.yml
Created June 2, 2017 21:02
A command that will npm install for running in docker-compose
# This compose file will deploy the services, and bootup a mongo server.
# Local `/opt/cello/mongo` will be used for the db storage.
# dashboard: dashboard service of cello, listen on 8080
# app: app service of cello, listen on 80
# nginx: front end
# mongo: mongo db
version: '2'
services:
# cello dashboard service
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
"contentVersion": "1.0.0.0",
"parameters": {
"eventHubName": {
"type": "string"
}
},
"variables": {
"resourceLocation": "[resourceGroup().location]",
@cicorias
cicorias / appInsights.json
Created June 12, 2017 21:26
Application Insights ARM Deployment
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"appInsightsName": {
"type": "string",
"metadata": {
"description": "The name of the application insights to create this rules for"
}
},
@cicorias
cicorias / vsts.sh
Created June 14, 2017 00:32
VSTS on Ubuntu Docker
#!/usr/bin/env bash
sudo docker run \
-e VSTS_ACCOUNT=mspoc \
-e VSTS_TOKEN=..... \
-e VSTS_AGENT='$(hostname)-agent' \
-e VSTS_POOL='Default' \
-e VSTS_WORK='/var/vsts/$VSTS_AGENT' \
-e LARGEDISK=true \
-v /datadrive/vsts:/var/vsts \
@cicorias
cicorias / expbackoff.sh
Created June 14, 2017 17:28 — forked from nathforge/expbackoff.sh
Exponential backoff in Bash
expbackoff() {
# Exponential backoff: retries a command upon failure, scaling up the delay between retries.
# Example: "expbackoff my_command --with --some --args --maybe"
local MAX_RETRIES=${EXPBACKOFF_MAX_RETRIES:-8} # Max number of retries
local BASE=${EXPBACKOFF_BASE:-1} # Base value for backoff calculation
local MAX=${EXPBACKOFF_MAX:-300} # Max value for backoff calculation
local FAILURES=0
while ! "$@"; do
FAILURES=$(( $FAILURES + 1 ))
if (( $FAILURES > $MAX_RETRIES )); then
@cicorias
cicorias / exponential.sh
Created June 14, 2017 17:28
Exponential backoff in Bash
# Retries a command a with backoff.
#
# The retry count is given by ATTEMPTS (default 5), the
# initial backoff timeout is given by TIMEOUT in seconds
# (default 1.)
#
# Successive backoffs double the timeout.
#
# Beware of set -e killing your whole script!
function with_backoff {
@cicorias
cicorias / 2.sh
Last active June 14, 2017 22:30
Windows bash term colors
LS_COLORS='rs=0:di=1;35:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*
@cicorias
cicorias / renameBranch.sh
Created June 15, 2017 22:18
rename a git branch
#expects $1 is old_name, $2 is new_name
git branch -m $2
git push origin :$1 $2
git push origin -u $2
@cicorias
cicorias / cntkStart.sh
Created June 18, 2017 22:52
CNTK startup
docker run -d -p 8888:8888 --name cntk-jupyter-notebooks -t microsoft/cntk
docker exec -it cntk-jupyter-notebooks bash -c "source /cntk/activate-cntk && \
jupyter-notebook --no-browser --port=8888 --ip=0.0.0.0 --notebook-dir=/cntk/Tutorials --allow-root"
# From PowerShell ADMINISTRATOR session run
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
# Open new PowerSheel Administrator session and run
# $cred=Get-Credential domain\username (can also use [email protected] MSA style username)
# Install-BoxstarterPackage -PackageName https://gist.githubusercontent.com/tylergibson/bd7a4c923db6bc0bd0a3ca05473dd4f7/raw -Credential $cred
# Initialize reboot log file
$reboot_log = "C:\installation.rbt"
if ( -not (Test-Path $reboot_log) ) { New-Item $reboot_log -type file }