Skip to content

Instantly share code, notes, and snippets.

@davelee212
davelee212 / import-vse-fw-rules.ps1
Last active September 29, 2020 13:02
import-vse-fw-rules.ps1
# Run from a PowerCLI shell that has been logged into the vCloud Director instance using “Connect-CIServer -server url”
# and then run the script passing the following parameters:
# -file or -f = The CSV file containing the rules to import
# -edge or -e = The Edge Gateway Name
#
# Example:
# ./import-vse-fw-rules.ps1 -f myfwrules.csv -e “My vShield Edge”
param (
[parameter(Mandatory = $true, HelpMessage="Edge Gateway Name")][alias("-edge","e")][ValidateNotNullOrEmpty()][string[]]$egwname,
@tboerger
tboerger / inventory.py
Last active March 16, 2023 15:48
Dynamic inventory for Ansible on VMWare vCloud director
#!/usr/bin/env python3
import json
import requests
import os
import argparse
import xml.etree.cElementTree as ET
from time import time
GLOBALS = {
@ddgenome
ddgenome / aws-creds.bash
Last active February 5, 2024 19:32
Fetch AWS STS keys and set environment variables
#!/bin/bash
# Fetch 24-hour AWS STS session token and set appropriate environment variables.
# See http://docs.aws.amazon.com/cli/latest/reference/sts/get-session-token.html .
# You must have jq installed and in your PATH https://stedolan.github.io/jq/ .
# Add this function to your .bashrc or save it to a file and source that file from .bashrc .
# https://gist.github.com/ddgenome/f13f15dd01fb88538dd6fac8c7e73f8c
#
# usage: aws-creds MFA_TOKEN [OTHER_AWS_STS_GET-SESSION-TOKEN_OPTIONS...]
function aws-creds () {
local pkg=aws-creds
@ajdruff
ajdruff / fix-git-line-endings
Last active February 29, 2024 13:02
Forces all line endings to LF in your git repo.
#####################
#
# Use this with or without the .gitattributes snippet with this Gist
# create a fixle.sh file, paste this in and run it.
# Why do you want this ? Because Git will see diffs between files shared between Linux and Windows due to differences in line ending handling ( Windows uses CRLF and Unix LF)
# This Gist normalizes handling by forcing everything to use Unix style.
#####################
# Fix Line Endings - Force All Line Endings to LF and Not Windows Default CR or CRLF