Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Austrian Association for Software Tool Integration (AASTI)
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information regarding copyright
ownership. The AASTI licenses this file to you under the Apache License,
Version 2.0 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
@ajorpheus
ajorpheus / gist:3382de02fd569cd27071eb9ab681ca1f
Last active January 30, 2019 19:27 — forked from kevinhooke/gist:d2eabbd402741ae728ef6ab2985dfddd
Using Docker on Windows with Cisco AnyConnect VPN in non-split tunnel mode
@neurogenesis
neurogenesis / terraforming-import-all
Created September 27, 2019 22:28
generate terraform templates from existing infrastructure (via terraforming)
#!/usr/bin/env ruby
# USAGE:
# gem install terraforming
# export AWS_PROFILE=xxx
# mkdir -p ~/projects/terraform
# cd ~/projects/terraform
# mkdir -p imports/[account]/[region]
# cd imports/[account]/[region]
# ../../../bin/terraforming-import-all
@razielgn
razielgn / .bashrc.bash
Created March 16, 2017 19:29
Automatically start tmux on ssh connection. Logout on detach.
# Original: http://blog.thelinuxkid.com/2013/06/automatically-start-tmux-on-ssh.html
# Saving for our children.
# This should always be run last either in .bashrc or as a script in .bashrc.d
if [[ -z "$TMUX" ]]; then
tmux has-session &> /dev/null
if [ $? -eq 1 ]; then
exec tmux new
exit
else
@tuannvm
tuannvm / 0.12.tf
Last active December 3, 2022 18:50
#terraform #hashicorp #cheatsheet #0.12
#### first class expresssion
variable "ami" {}
resource "aws_instance" "example" {
ami = var.ami
}
#### list & map
resource "aws_instance" "example" {
vpc_security_group_ids = var.security_group_id != "" ? [var.security_group_id] : []
}
@nicksmarto
nicksmarto / makeTodo.js
Created October 13, 2017 21:19
Google Aps Script for Sheets to automatically pull, format, sort and populate active Todoist tasks in to Google Sheet
//*********************************************************************************************************
//makeTodo: Call other functions to make the daily Todo
//*********************************************************************************************************
function makeTodo(){
//Populate Header
grabHeader("B1")
//Populate Task List
@bennyrw
bennyrw / generateAwsCredsFile.js
Created September 23, 2022 09:53
Generate AWS credentials file content from SSO
//
// Intended to be used as a bookmarklet that is executed when on the AWS Single Sign-On landing page,
// this script scans the named SSO application and its accounts (specified below) and generates the
// ~/.aws/credentials content and copies it to the clipboard ready to be used.
//
// the SSO application to use
const APPLICATION_TITLE = "AWS Account";
// specify the names of the accounts to include (case sensitive). Any that are not found will be ignored.
@vatshat
vatshat / cwl_insights_parse_regex.sh
Created January 29, 2019 18:25
An example of how to use regex in the parse statement of a CloudWatch Insights query
#!/usr/bin/env bash
query_string=$(cat << EndOfMessage
fields @timestamp, @logStream, headers.X-Amzn-Trace-Id, @transId, @message
| parse @message /(transactionId:[ ]?)(?<@transId>[a-zA-Z0-9]+)/
| filter @transId = a4c475516be5445a87fbb81bb7a4b365
EndOfMessage
) \
&& \
query_id=`aws logs start-query --log-group-name /aws/lambda/console_log \
@kgmoore431
kgmoore431 / delete_iam_user.sh
Created June 2, 2017 05:35
Delete an IAM user with AWS CLI
#!/bin/bash
user_name="$1"
echo "Removing user: ${user_name}"
echo "Deleting Access Keys:"
keys=("$(aws iam list-access-keys --user-name "${user_name}" | jq -r '.AccessKeyMetadata[] | .AccessKeyId')")
if [[ "${#keys}" -gt "0" ]]; then
# shellcheck disable=SC2068
@rkuzsma
rkuzsma / docker-bash-completion.md
Last active November 18, 2023 09:11
How to configure Bash Completion on Mac for Docker and Docker-Compose

How to configure Bash Completion on Mac for Docker and Docker-Compose

Copied from the official Docker-for-mac documentation (thanks Brett for the updated doc pointer):

Install shell completion

Docker Desktop for Mac comes with scripts to enable completion for the docker, docker-machine, and docker-compose commands. The completion scripts may be found inside Docker.app, in the Contents/Resources/etc/ directory and can be installed both in Bash and Zsh.

Bash

Bash has built-in support for completion To activate completion for Docker commands, these files need to be copied or symlinked to your bash_completion.d/ directory. For example, if you installed bash via Homebrew: