Skip to content

Instantly share code, notes, and snippets.

View stevebargelt's full-sized avatar
🏠
Working from home

Steve Bargelt stevebargelt

🏠
Working from home
View GitHub Profile
@dazfuller
dazfuller / .\templates\function-app.bicep
Last active December 14, 2023 11:01
Example template for deploying an Azure Function app with KeyVault references all set in Bicep
/*
** Parameters
*/
@minLength(3)
@maxLength(6)
@description('Prefix to be used by all resources deployed by this template')
param resourcePrefix string = 'demo'
@allowed([
'Standard_LRS'
@stinger
stinger / CombineFetcherAndDecoder.swift
Last active February 17, 2024 02:07
Combine - fetching and decoding JSON data
import Foundation
import Combine
enum APIError: Error, LocalizedError {
case unknown, apiError(reason: String), parserError(reason: String)
var errorDescription: String? {
switch self {
case .unknown:
return "Unknown error"
@jonico
jonico / Jenkinsfile
Last active January 31, 2024 09:43
Example for a full blown Jenkins pipeline script with CodeQL analysis steps, multiple stages, Kubernetes templates, shared volumes, input steps, injected credentials, heroku deploy, sonarqube and artifactory integration, Docker containers, multiple Git commit statuses, PR merge vs branch build detection, REST API calls to GitHub deployment API, …
#!groovy
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
def label = "mypod-${UUID.randomUUID().toString()}"
podTemplate(label: label, yaml: """
spec:
containers:
- name: mvn
image: maven:3.3.9-jdk-8
@ccampanale
ccampanale / vaultsealmanager.sh
Created December 10, 2015 19:31
Bash shell script to check seal status for local vault server and attempt to unseal using keys secured in vault secret store. Supports HA Vault clusters with TLS with unseal keys stored as secrets in vault (see code). Relies on registered service vault.service.consul, in place DNS configuration, and a single unsealed vault instance in your clust…
#!/bin/bash
export vault=/usr/local/bin/vault
export VAULT_TOKEN=$(cat /root/.vault-token)
vault_cacert='-ca-cert=/path/to/your/ca.pem'
local_vault="-address=https://$(hostname -f):8200"
unsealed_vault="-address=https://$(getent hosts $(dig +short vault.service.consul | tail -n 1) | awk '{ print $2 }'):8200"
leader_vault="-address=https://$($vault status $vault_cacert $unsealed_vault 2> /dev/null | grep Leader | awk '{ print $2 }' | sed 's/^http\(\|s\):\/\///g'):8200"
vault_read="$vault read $vault_cacert $leader_vault"
vault_unseal="$vault unseal $vault_cacert $local_vault"
@masha256
masha256 / README.md
Last active February 16, 2017 11:49
Google Pie Chart for Dashing

Description

A Dashing widget to show a Google Visualizations Pie Chart on a dashboard.

Installation

Copy the google_pie.coffee, google_pie.html and google_pie.scss file to into /widgets/google_pie directory.

Add the following to the dashboard layout file:

@masha256
masha256 / README.md
Last active January 3, 2021 07:54
Google Gauge for Dashing

Description

A Dashing widget to show a Google Visualizations Gauge on a dashboard.

Installation

Copy the google_gauge.coffee, google_gauge.html and google_gauge.scss file to into /widgets/google_gauge directory.

Add the following to the dashboard layout file:

@masha256
masha256 / README.md
Last active August 3, 2017 08:53
Google Column Chart for Dashing

Description

A Dashing widget to show a Google Visualizations Column Chart on a dashboard.

Installation

Copy the google_column.coffee, google_column.html and google_column.scss file to into /widgets/google_column directory.

Add the following to the dashboard layout file:

@jmar777
jmar777 / debugging-node-elastic-beanstalk-woes
Created February 28, 2014 22:32
Debugging "Failed to run npm install. Snapshot logs for more details." on Elastic Beanstalk
First, we need to figure out what the actual error is. This is obviously frustrating given that the error message is intentionally truncating it.
1) SSH in to your node (various guides available for this if you're not already familiar with this).
2) Run this command (basically an Elastic Beanstalk wrapper command for npm install I found in a blog post [1]):
$ sudo /opt/elasticbeanstalk/containerfiles/ebnode.py --action npm-install 2
3) Find the actual error message in the output from the npm install.
Once you know the error, it should hopefully be fairly obvious how to fix it. I've run into two different errors over the last couple days on Elastic Beanstalk:
The first was a dependency that was using the new "^X.Y.Z" version syntax, which is only supported in Node >= v0.10.26 (whereas Elastic Beanstalk only supports up to v0.10.21 as of today). The solution here was easy: hardcode a dependency version *prior* to when that dependency adopted to the new syntax.
@ZevEisenberg
ZevEisenberg / moveAssetImages.sh
Created February 25, 2014 05:17
Shell script to move a folder of correctly-named image files into their respective .xcassets subfolders
#!/bin/sh
function moveAssetImages
{
usage="usage: moveAssetImages /path/to/folderOfImages /path/to/Images.xcassets"
sourceDir=$1
assetsDir=$2
if [ $# != 2 ]; then
@mattia72
mattia72 / FullPie.md
Last active August 22, 2019 16:19 — forked from stevenleeg/pie.coffee
This is a simple widget that lets you render pie charts in Dashing.

FullPie widget

This is a simple widget that lets you render pie charts in Dashing. Forked from stevenleeg/pie.coffee It looks a little bit like this:

Screenshot

Usage

dashboard.erb: