Random recipes of JMESPath for the AWS CLI tools that I might have written or stumbled upon.
This file contains hidden or 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
#!/usr/bin/env python2.7 | |
# | |
# kills openresty nginx and possibly regular nginx '"hung"' worker processes | |
# | |
# version 0.1 | |
# | |
import psutil | |
import os | |
import time |
This file contains hidden or 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
#!/usr/bin/env python2.7 | |
# | |
# kills openresty nginx and possibly regular nginx '"hung"' worker processes | |
# | |
# version 0.1 | |
# | |
import psutil | |
import os | |
import time |
This file contains hidden or 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
def touch(path): | |
with open(path, 'a'): | |
os.utime(path, None) |
This file contains hidden or 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
def touch(path): | |
with open(path, 'a'): | |
os.utime(path, None) | |
def lock_file(LOCK_FILE): | |
now = datetime.now() | |
restart_hours = [1] | |
if now.hour in restart_hours: | |
if VERBOSE: PrettyLogger(log_level="info", msg="H|Restart hour hgreen|Found.") |
This file contains hidden or 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
{{/* get unix times for systems in service group */}} | |
{{range ls "mykv/myservice"}} | |
{{ $int := .Value | parseInt}} | |
{{ scratch.MapSetX "nodetimes" .Key $int}}{{ end }} | |
{{/* create map of names */}} | |
{{ range service "myservice|passing" }} | |
{{ $node := .Node }} | |
{{ scratch.MapSetX "names" $node $node }}{{ end }} | |
{{/* create map of time differences from "now" for each server */}} | |
{{ range $hkey, $hval := scratch.Get "nodetimes" }} |
This file contains hidden or 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 sqlite3 | |
db = sqlite3.connect('yomomma.db') | |
tables = { | |
"table1" : { | |
"stuff" : "INTEGER unique PRIMARY KEY", | |
"stuff2" : "INTEGER", | |
"stuff3" : "INTEGER", | |
}, |
This file contains hidden or 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
#!/usr/bin/env python3.6 | |
import os | |
from selenium import webdriver | |
from selenium.webdriver.common.by import By as by | |
from selenium.webdriver.chrome.options import Options | |
from selenium.webdriver.support.ui import WebDriverWait | |
from selenium.webdriver.support import expected_conditions as expect | |
CHROME_PATH = '/usr/bin/google-chrome' |
This file contains hidden or 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
#!/usr/bin/env python3.7 | |
import iterm2 | |
import re | |
import os | |
import socket | |
import pprint | |
import asyncio | |
def sshToProccesTextRedux(lines): |
This file contains hidden or 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
#!/usr/bin/env python3 | |
import os | |
import re | |
import sys | |
import time | |
import math | |
import json | |
import boto | |
import boto3 | |
import random |
OlderNewer