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
# Count total EBS based storage in AWS | |
aws ec2 describe-volumes | jq "[.Volumes[].Size] | add" | |
# Count total EBS storage with a tag filter | |
aws ec2 describe-volumes --filters "Name=tag:Name,Values=CloudEndure Volume qjenc" | jq "[.Volumes[].Size] | add" | |
# Describe instances concisely | |
aws ec2 describe-instances | jq '[.Reservations | .[] | .Instances | .[] | {InstanceId: .InstanceId, State: .State, SubnetId: .SubnetId, VpcId: .VpcId, Name: (.Tags[]|select(.Key=="Name")|.Value)}]' | |
# Wait until $instance_id is running and then immediately stop it again | |
aws ec2 wait instance-running --instance-id $instance_id && aws ec2 stop-instances --instance-id $instance_id | |
# Get 10th instance in the account |
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
$WorkingDir = "$HOME/Documents/dfsr-logs" | |
new-alias 7z "C:\Program Files\7-zip\7z.exe" | |
cp C:/Windows/debug/Dfsr00999.log.gz $WorkingDir | |
rm -recurse -force $WorkingDir/extracted | |
7z e $WorkingDir/Dfsr00999.log.gz "-o$WorkingDir\extracted" | |
# gc $workingdir\extracted\Dfsr00999.log | sls "^[^+]" | |
echo "Last 60 lines of DFSR log" | |
gc $workingdir/extracted/Dfsr00999.log -tail 60 |
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
# You will need to run this in the shell first... | |
Set-ExecutionPolicy Unrestricted | |
# Install chocolatey | |
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex | |
# Install my selection of useful software | |
choco install googlechrome flashplayerplugin javaruntime adobereader 7zip.install atom procexp sysinternals curl mRemoteNG gimp vim python2 python windirstat libreoffice partitionwizard skype macrium | |
# Finish off the installation of Macrium | |
(Invoke-Command "C:\tools\ReflectDL.exe") -and (rm "C:\tools\ReflectDL.exe") | |
# Add a local user |
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 | |
# An example hook script to verify what is about to be pushed. Called by "git | |
# push" after it has checked the remote status, but before anything has been | |
# pushed. If this script exits with a non-zero status nothing will be pushed. | |
# | |
# This hook is called with the following parameters: | |
# | |
# $1 -- Name of the remote to which the push is being done | |
# $2 -- URL to which the push is being done |
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
import boto3 | |
def depaginate(function, resource_key, **kwargs): | |
# Will depaginate results made to an aws client | |
response = function(**kwargs) | |
results = response[resource_key] | |
while (response.get("NextToken", None) is not None): | |
response = function(NextToken=response.get("NextToken"), **kwargs) | |
results = results + response[resource_key] | |
return results |
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 | |
# | |
# AWSCM: Command line tool for quickly switching between AWS profiles. | |
# To install: | |
# mkdir ~/.awscm/ | |
# curl $filepath > ~/.awscm/awscm.sh | |
# echo 'source ~/.awscm/awscm.sh' >> ~/.bashrc | |
# echo 'source ~/.awscm/awscm.sh' >> ~/.zshrc | |
OUTPUT_FORMATS=( |
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
import logging | |
import time | |
import yaml | |
from jaeger_client import Config | |
import os | |
import datetime | |
import logging | |
from logging import StreamHandler |
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
# Inspired by this great answer... | |
# https://stackoverflow.com/a/60785401 | |
import yaml | |
class SafeUnknownConstructor(yaml.constructor.SafeConstructor): | |
def __init__(self): | |
yaml.constructor.SafeConstructor.__init__(self) | |
def construct_undefined(self, node): |
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
###################### | |
# My CA - Create your own certificate authority! | |
# for people who need lots of certificates... | |
# | |
# Create a workspace and save this Makefile in the workspace | |
# $ mkdir ~/.ssl/ | |
# $ curl https://gist.githubusercontent.com/lukeplausin/b1e78b3b55490d91997bcb13532ce663/raw > ~/.ssl/Makefile | |
# $ cd ~/.ssl/ | |
# | |
# $ make ca # Generate the certificate authority |
OlderNewer