Skip to content

Instantly share code, notes, and snippets.

View EarthmanT's full-sized avatar
🏠
Working from home

EarthmanT

🏠
Working from home
View GitHub Profile
alias jqids="jq -r '.[].id'"
xplugins () {
for plugin in `cfy plugins list --json | jqids`;
do cfy plugins delete $plugin;
done
}
xexec () {
for deployment in `cfy deployments list --json | jqids`;
@EarthmanT
EarthmanT / gist:d478c2f1bb63b3211a243a036fb2fa22
Created August 29, 2021 18:24
Kubectl Create and Get Token Bash
sudo su docker
minikube kubectl -- apply -f - <<EOF
apiVersion: v1
kind: ServiceAccount
metadata:
name: demo-account
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
@EarthmanT
EarthmanT / aws_mfa.py
Created September 10, 2020 13:02
Create MFA Session Token and List s3 Buckets
import os
import boto3
import pyotp
def get_mfa_session_token(long_term_aws_key,
longterm_aws_secret,
mfa_arn,
one_time_password,
token_ttl=900):
@EarthmanT
EarthmanT / gist:517de9ed6a832bb192f097190af164ef
Created April 20, 2020 11:33
Cloudify Futurize Stage 2 Fixers
--stage1
-f lib2to3.fixes.fix_getcwdu
-f lib2to3.fixes.fix_long
-f lib2to3.fixes.fix_nonzero
-f lib2to3.fixes.fix_input
-f lib2to3.fixes.fix_raw_input
-f lib2to3.fixes.fix_itertools
-f lib2to3.fixes.fix_itertools_imports
-f lib2to3.fixes.fix_exec
-f lib2to3.fixes.fix_operator
@EarthmanT
EarthmanT / gist:351dfdd817bebe454fe246217537589f
Created April 20, 2020 11:30
Cloudify Futurize Stage 1 Fixers
-f lib2to3.fixes.fix_apply
-f lib2to3.fixes.fix_except
-f lib2to3.fixes.fix_exitfunc
-f lib2to3.fixes.fix_funcattrs
-f lib2to3.fixes.fix_has_key
-f lib2to3.fixes.fix_idioms
-f lib2to3.fixes.fix_intern
-f lib2to3.fixes.fix_isinstance
-f lib2to3.fixes.fix_methodattrs
-f lib2to3.fixes.fix_ne
> futurize -wn --stage1 my_code
RefactoringTool: Skipping optional fixer: idioms
RefactoringTool: Skipping optional fixer: ws_comma
RefactoringTool: No changes to my_code/common.py
RefactoringTool: No changes to my_code/utils.py
RefactoringTool: No changes to my_code/module/functions.py
RefactoringTool: Refactored my_code/tests/test_functions.py
--- my_code/tests/test_functions.py (original)
+++ my_code/tests/test_functions.py (refactored)
@@ -1,3 +1,5 @@
@EarthmanT
EarthmanT / git_submodule_replacement.md
Created February 17, 2019 10:25 — forked from MJeorrett/git_submodule_replacement.md
Replace directory with git submodule

These are the steps required to replace a directory with a submodule in git. Note: Assumes that you are currently working on branch called 'develop'

  1. Check out a new branch to make the changes on: git checkout -b creating-submodule
  2. delete directory to be replaced rm -rf path/of/directory/to/be/replaced
  3. git add . then git commit -m "removing local directory"
  4. add the submodule: git submodule add "https://github.com/repoName" path/of/directory/to/be/replaced
  5. git add . then git commit -m "adding submodule"
  6. delete the submodule directory if you don't do this git will throw a hissy when you try to checkout out develop to merge the changes in
  7. git checkout develop
  8. pull the submodule back into the local repo: git submodule foreach git fetch --tags then git submodule update --init --recursive
# Assuming you are using a Python shell like ipython.
# Create a Virtual env: `mktmpenv`
# Install Cloudify: `pip install cloudify`
# Open ipython: `ipython`.
from cloudify_rest_client import CloudifyClient
from copy import deepcopy
import json
manager_ip = '106.105.105.105' # Set your own value here.
@EarthmanT
EarthmanT / update_provider_context.py
Last active August 30, 2017 09:01
Update Cloudify Manager Provider Context (4.1.1) - Modify Task Retries/Task Retry Interval/Agent Key Path/etc
# Assuming you are using a Python shell like ipython.
# Create a Virtual env: `mktmpenv`
# Install Cloudify: `pip install cloudify`
# Open ipython: `ipython`.
from cloudify_rest_client import CloudifyClient
from copy import deepcopy
import json
manager_ip = '106.105.105.105' # Set your own value here.
@EarthmanT
EarthmanT / openstack_vm_with_docker.yaml
Created February 5, 2017 09:12
Create Openstack VM and Install Docker
node_templates:
docker:
type: cloudify.nodes.Root
interfaces:
cloudify.interfaces.lifecycle:
create:
implementation: scripts/docker/install.py
start:
implementation: scripts/docker/bootstrap.py