Skip to content

Instantly share code, notes, and snippets.

View jondkelley's full-sized avatar
:octocat:

Jonathan D Kelley jondkelley

:octocat:
View GitHub Profile
@jondkelley
jondkelley / __INSTALL_MINIKUBE.txt
Last active February 14, 2024 21:59
Flink on k8s Issue
kubectl apply -f flink-configuration-configmap.yaml
kubectl apply -f jobmanager-svc.yaml
kubectl apply -f jobmanager-session-deployment.yaml -f task-manager-session-deployment.yaml
@jondkelley
jondkelley / readme.md
Last active January 30, 2024 15:51
Linux Awesome Gists 1: Sending a file from command line one-liners

Send an attachment via email on bash using...

mailx

Install Debian/Ubuntu

  • apt-get install postfix

Alternatively, without the bloat of postfix

@jondkelley
jondkelley / terralock.py
Last active June 13, 2023 20:49
Removes a broken terraform lock state
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
# To fix this issue in terraform:
# Failed to unlock state: failed to retrieve lock info: unexpected end of JSON input
# Python does what Terraform cannot do!
"""Delete terraform lock
Usage:
terralock.py --list --table TABLE_NAME
@jondkelley
jondkelley / 1_playbook_best_practices.md
Last active October 20, 2022 16:56
Linux Awesome Gists: Ansible Best Practices

Ansible Playbook Design & Best Practices

The complexity you might consider dictates the style of your environments as you see the examples 'good' 'better' and 'best' below. The best is not always better if it's a waste of time after all.

General best-advice writing root playbooks

Tips

  • Do use hosts: limiters to the least destructive inclusion group for added safety whenever possible.
  • Do use extended block notation if you need additional levels of control around playbook / role execution.
@jondkelley
jondkelley / netstat without netstat.txt
Created May 10, 2022 22:25
netstat without netstat
awk 'function hextodec(str,ret,n,i,k,c){
ret = 0
n = length(str)
for (i = 1; i <= n; i++) {
c = tolower(substr(str, i, 1))
k = index("123456789abcdef", c)
ret = ret * 16 + k
}
return ret
}
@jondkelley
jondkelley / busy_box_non_root.yaml
Created April 7, 2022 14:16
busy box non root
# 1) Deploy the pod
#
# kubectl create -f busybox-non-root.yaml
#
# 2) Access the shell
#
# kubectl exec -ti busybox-1000 -- sh
#
# 3) from the shell run:
#
class JenkinsBuilder(object):
"""
helper class for triggering jenkins jobs with the proper parameters
"""
def __init__(self, logger, baseurl, user, user_token, job, job_token):
self.logger = logger
self.baseurl = baseurl
self.user = user
@jondkelley
jondkelley / delete_dicts_by_keyname_rercusively.py
Last active October 24, 2021 21:36
Python Dictionary Stuff from Stackoverflow
#The version that modifies in-place (very much like Ned Batchelders solution):
# https://stackoverflow.com/questions/3405715/elegant-way-to-remove-fields-from-nested-dictionaries
from collections import MutableMapping
from contextlib import suppress
def delete_keys_from_dict(dictionary, keys):
for key in keys:
with suppress(KeyError):
del dictionary[key]
@jondkelley
jondkelley / readme.md
Created December 13, 2019 19:50
Bash getopt long options with values usage example.

Bash getopt long options with values usage example

#!/bin/bash -e
# default args
TEST_MODE=FALSE
ENDPOINT_HOSTNAME=""
AUX=""

FLAG_LIST=(