Skip to content

Instantly share code, notes, and snippets.

@decklord
decklord / rfc3339.py
Last active October 9, 2019 10:47
This gist shows how to calculate the diff in seconds between host UTC time and Google Cloud remote machine creation UTC time and use it to wait_for SSH only if the machine is new to avoid being blocked by SSH Guard
#!/usr/bin/python
import datetime
class FilterModule(object):
def filters(self):
return {
'rfc3339_to_utc': self.rfc3339_to_utc
}
@decklord
decklord / gist:3dd17499972635b2c858d10d7d260bdc
Created January 23, 2020 14:34
First code challenge for Adereso.
Hi, welcome to Adereso's first code challenge.
You need to implement a function called "letter_counter". It's first and only parameter will be called "letters".
The "letter" parameter should be a string and will contain, as it naims states, only letters, like "abcdef".
Your function must output a dictionary with the number of aparition of each letter.
Examples:
"abc" outputs: {"a":1, "b":2, "c":3}
"zaxayyyy" outputs: {"z":1, "a":2, "x":1, "y": 4}