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 | |
if [ $# -lt 1 ]; then | |
cat << EOF | |
usage: awslogin <profile> | |
Utility script for logging into AWS CLI named profile with an MFA token. | |
A session token will be requested and the "default" profile will be updated | |
with the valid session data. Make sure you have a named profile configured | |
as described below, including the "mfa" arn: |
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/sh | |
# Based on BMitch's answer from: | |
# https://stackoverflow.com/questions/38946683/how-to-test-dockerignore-file | |
# Note: will create and delete temporary file "Dockerfile.build-context" | |
# 1. Copy to project folder where image is being built | |
# 2. Run script | |
# 3. You should see list of files in build context |
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
/* | |
Example for AWS SQL Server RDS instance: | |
- create database | |
- create login with basic permissions | |
Since RDS is managed there are some restrictions when creating users and assigning | |
permissions. This procedure shows how to create a database and login with combinations | |
of ddl, read and write permissions. | |
*/ | |
create procedure #createdbuser ( |
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
# The Rancher 2 server container generates its own certificate but for some reason | |
# my browser wouldn't accept it, and didn't give me the option to override. Here's | |
# a way to generate a self-signed cert and use it to start the container. | |
# Note: I ran this on Git Bash shell in Windows 10, format for Linux may differ | |
# Generate certificate and key | |
openssl req -x509 -newkey rsa:4096 \ | |
-keyout key.pem -out cert.pem \ | |
-days 1000 -nodes \ |
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
# I've installed Docker for Windows and enabled the Kubernetes cluster | |
# My kubectl context is "docker-for-desktop" (right-click on docker tray icon > Kubernetes > docker-for-desktop) | |
# Docker should have updated my ~/.kube/config file for kubectl access | |
# Install the dashboard as per https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/ by running: | |
kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml | |
# Using git bash shell on windows: | |
grep 'client-certificate-data' ~/.kube/config | awk '{print $2}' | base64 -d >> kubecfg.crt | |
grep 'client-key-data' ~/.kube/config | awk '{print $2}' | base64 -d >> kubecfg.key |
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
$script = <<-SCRIPT | |
#!/bin/sh | |
set -ex | |
apt-get update && apt-get install -y apt-transport-https | |
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - | |
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee > /etc/apt/sources.list.d/kubernetes.list | |
apt-get update && apt-get install -y docker.io kubeadm | |
swapoff -a | |
sudo sed -i.bak '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab |
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
{-- | |
Iterate through a list and compare each element to all the others to decide what to keep | |
Run at http://elm-lang.org:1234/try | |
--} | |
import Html exposing (text, div, br) | |
import String exposing (..) | |
initial = ["a", "ab", "c", "cdb", "cd"] |
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
{-- | |
Some Elm code for various ways to iterate over a map | |
Run at http://elm-lang.org:1234/try | |
--} | |
import Html exposing (text, div, br) | |
import Dict exposing (Dict) | |
import String exposing (toUpper) |
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
{-- | |
Some Elm code for a map of sets. This maps prices to the set of items | |
with that price. | |
Run at http://elm-lang.org:1234/try | |
--} | |
import Html exposing (text, div, br) | |
import Dict exposing (Dict) | |
import Set exposing (Set) |
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
// Assume folder containing script is in the classpath | |
// To append current folder to classpath can pass: -Xbootclasspath/a:. | |
// load from file system | |
val fileContent = java.io.File("loadResource.kts").readText() | |
println("file content length: ${fileContent.length}") | |
// load via class path (can also use javaClass.getResource method but seems more reliable to go via class loader) | |
val urlContent = javaClass.classLoader.getResource("loadResource.kts").readText() | |
println("url content length: ${urlContent.length}") |
NewerOlder