In your command-line run the following commands:
brew doctor
brew update
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam' | |
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes' | |
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no' |
In your command-line run the following commands:
brew doctor
brew update
Random query recipes of JMESPath for the AWS CLI tools that I might have written or stumbled upon.
#!/bin/bash | |
# | |
# Copyright 2017-2021 Martin Goellnitz | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, |
import tensorflow as tf | |
class ImportGraph(): | |
""" Importing and running isolated TF graph """ | |
def __init__(self, loc): | |
# Create local graph and use it in the session | |
self.graph = tf.Graph() | |
self.sess = tf.Session(graph=self.graph) | |
with self.graph.as_default(): | |
# Import saved model from location 'loc' into local graph |
import tarfile | |
import time | |
import json | |
from io import BytesIO | |
import docker | |
src_code = """ | |
if __name__ == "__main__": | |
print('Hello World, From Alpine!!!!!!!!!') | |
""" |
Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).
docker run -it --rm --privileged --pid=host justincormack/nsenter1
more info: https://github.com/justincormack/nsenter1
import csv | |
input_csv_file = '/path/to/test_csvfile.csv' | |
with open(input_csv_file, 'rb') as csvfile: #`with open(input_csv_file, 'r') as csvfile:` for Python 3 | |
csv_test_bytes = csvfile.read(1024) # Grab a sample of the CSV for format detection. | |
csvfile.seek(0) # Rewind | |
has_header = csv.Sniffer().has_header(csv_test_bytes) # Check to see if there's a header in the file. | |
dialect = csv.Sniffer().sniff(csv_test_bytes) # Check what kind of csv/tsv file we have. | |
inputreader = csv.reader(csvfile, dialect) |
# 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 |
docker run \ | |
--name={{.Name}} \ | |
{{range $e := .Config.Env}}--env={{printf "%q" $e}} \ | |
{{end}}{{range $p, $conf := .NetworkSettings.Ports}}{{with $conf}}-p {{(index $conf 0).HostIp}}:{{(index $conf 0).HostPort}}:{{$p}} \ | |
{{end}}{{end}}{{range $n, $conf := .NetworkSettings.Networks}}{{with $conf}}--network {{printf "%q" $n}} \ | |
{{range $conf.Aliases}}--network-alias {{printf "%q" .}} {{end}} \ | |
{{end}}{{end}}{{range $v := .HostConfig.VolumesFrom}}--volumes-from={{printf "%q" .}} \ | |
{{end}}{{range $v := .HostConfig.Binds}}--volume={{printf "%q" .}} \ | |
{{end}}{{range $l, $v := .Config.Labels}}--label {{printf "%q" $l}}={{printf "%q" $v}} \ | |
{{end}}{{range $v := .HostConfig.CapAdd}}--cap-add {{printf "%q" .}} \ |