Skip to content

Instantly share code, notes, and snippets.

View StevenACoffman's full-sized avatar

Steve Coffman StevenACoffman

View GitHub Profile
@StevenACoffman
StevenACoffman / slackWebhook.md
Created January 2, 2019 14:14 — forked from lakshmantgld/slackWebhook.md
Configuring slack webhook

A Webhook, in simple terms, is a user-defined HTTP callback. It is a mechanism for the system to notify you about an event. In our case, we need to send messages to a particular channel in slack. Slack calls in Incoming Webhook. It is a mechanism to send messages to your Slack Channel from external sources. These external sources could be any application or service that is capable of sending a JSON payload over HTTP into a Slack Channel. Each Channel will be identified by a unique Incoming Webhook URL to which you can post the message from outside. This configuration is done via the Integrations for your channel.

Steps to create a incoming webhook in Slack:

  1. Naviagte to the Incoming Webhook URL. Click the hyper link incoming webhook integration below the heading Incoming Webhooks.
  2. You will be asked to enter your team URL, followed by your slack credentials.
  3. Once you have completed the above step, you will see the wizard kind of webpage to
#!/bin/bash
# AWS CodePipeline execution status
#
# by Darren Hodges (http://github.com/hodglim)
#
# <bitbar.title>AWS CodePipeline execution status</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Darren Hodges</bitbar.author>
# <bitbar.author.github>hodglim</bitbar.author.github>
@StevenACoffman
StevenACoffman / codedeploy-to-slack.js
Created September 11, 2018 14:06 — forked from teeli/codedeploy-to-slack.js
CodeDeploy notifications to Slack (AWS Lambda via SNS)
var https = require('https');
var util = require('util');
exports.handler = function (event, context) {
console.log(JSON.stringify(event, null, 2));
console.log('From SNS:', event.Records[0].Sns.Message);
var severity = "good";
var message = event.Records[0].Sns.Message;
var messageJSON = JSON.parse(message);
@StevenACoffman
StevenACoffman / notify_slack.py
Created September 11, 2018 14:06 — forked from richardnbanks/notify_slack.py
AWS Lambda function to send notifications from CodeDeploy to Slack
from __future__ import print_function
import json, urllib, urllib2
def send_slack(message):
"""
Send Slack Message to Deployments Channel
"""
slack_token = ''
slack_channel = ''
slack_user = 'Deployment Bot'
@StevenACoffman
StevenACoffman / job_submit.py
Created July 25, 2018 01:22 — forked from kozikow/job_submit.py
Submiting job to kubernetes
import os
import re
import kubernetes
import logging
import math
from kubernetes.client import V1Container
from kubernetes.client import V1EnvVar
from kubernetes.client import V1Job
@StevenACoffman
StevenACoffman / cascade_delete.py
Created July 25, 2018 01:21 — forked from nomastmas/cascade_delete.py
script to reproduce pods not being deleted on job delete through python api client
from __future__ import unicode_literals
from time import sleep
import yaml
from kubernetes import client, config
from kubernetes.client.rest import ApiException
job_template = """
apiVersion: batch/v1
@StevenACoffman
StevenACoffman / job.yaml
Created July 22, 2018 23:41 — forked from alexellis/job.yaml
Use a Kubernetes Job and Kaniko to build an OpenFaaS function from Git
# Alex Ellis 2018
# Example from: https://blog.alexellis.io/quick-look-at-google-kaniko/
# Pre-steps:
# kubectl create secret generic docker-config --from-file $HOME/.docker/config.json
# Other potential optimizations (suggested by @errordeveloper)
# - Store "templates" in a permanent volume
# - Download source via "tar" instead of git clone
@StevenACoffman
StevenACoffman / kubernetes_add_service_account_kubeconfig.sh
Last active November 1, 2019 21:12 — forked from innovia/kubernetes_add_service_account_kubeconfig.sh
Create a service account and generate a kubeconfig file for it - this will also set the default namespace for the service account, and RBAC
#!/bin/bash -e
# NOTE: CHANGE THE S3_PREFIX!!!
# Add user to k8s 1.6+ using service account, RBAC for jobs and extensions only
if [[ -z "$1" ]] || [[ -z "$2" ]];then
echo "usage: $0 <service-account> <namespace (stg|prod)>"
exit 1
fi
SERVICE_ACCOUNT_NAME=$1
#!/bin/bash
# Check if a value exists in an array
# @param $1 mixed Needle
# @param $2 array Haystack
# @return Success (0) if value exists, Failure (1) otherwise
# Usage: in_array "$needle" "${haystack[@]}"
# See: http://fvue.nl/wiki/Bash:_Check_if_array_element_exists
in_array() {
@StevenACoffman
StevenACoffman / golang_kinesis.go
Created May 9, 2018 00:16 — forked from coboshm/golang_kinesis.go
Golang + Kinesis firehose
package main
import (
"log"
"encoding/json"
"fmt"
"os"
"math/rand"