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
#! /bin/sh | |
# Starts and stops Node-RED | |
# /etc/init.d/node-red | |
### BEGIN INIT INFO | |
# Provides: node-red | |
# Required-Start: $syslog | |
# Required-Stop: $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Node-RED initialisation |
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 re | |
import csv | |
re_degenerates = re.compile(r"[wsmkrybdhvn]") | |
def get_patterns(filename): | |
with open(filename) as f: | |
#lines = f.readlines()[2:] # the first two lines aren't data | |
lines = f.readlines() | |
for record in csv.reader(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
def collatz(): | |
global number | |
if number % 2 == 0: | |
number = number // 2 | |
print(number) | |
return number | |
else: | |
number = number * 3 + 1 |
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
#!/bin/zsh | |
# Fetch 24-hour AWS STS session token and set appropriate environment variables. | |
# See http://docs.aws.amazon.com/cli/latest/reference/sts/get-session-token.html . | |
# You must have jq installed and in your PATH https://stedolan.github.io/jq/ . | |
# Add this function to your .bashrc or save it to a file and source that file from .bashrc . | |
# Online: https://gist.github.com/hovissimo/c9119820a5a4f5a6081d93f87f1688b4 | |
# Adapted from https://gist.github.com/ddgenome/f13f15dd01fb88538dd6fac8c7e73f8c | |
# | |
# usage: aws-creds AWS_PROFILE MFA_TOKEN [OTHER_AWS_STS_GET-SESSION-TOKEN_OPTIONS...] | |
# example: aws-creds staging 123456 |