This file contains 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 fish | |
# Remove kernels older than the latest, but excluding the one currently booted | |
# from. | |
## This is ideal for when you've managed to fill your boot partition and can't | |
## finish an `apt upgrade` | |
set current_version (uname -r) | |
set top_version (dpkg --get-selections | grep install | awk '{print $1}' | egrep '^linux-image-[0-9].*$' | sort -r | head -n 1) |
This file contains 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 | |
# this is designed to be used as part of a command line like: | |
# find Maildir/cur/ -type f -newermt '02/23/2019 0:00:00' | xargs ./emailfromparser.py | sort | uniq > new_emails.csv | |
from sys import argv, stdout, stderr | |
from csv import DictWriter | |
from email.parser import BytesHeaderParser | |
from email.utils import parseaddr |
This file contains 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
from concurrent.futures import ThreadPoolExecutor | |
from os import getpid | |
from time import sleep | |
executor = ThreadPoolExecutor(max_workers=20) | |
def print_pid_and_sleep(): | |
while True: | |
print(getpid()) | |
sleep(10) |
This file contains 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
@app.route("/claims/new-employment-end-date", methods=["POST"]) | |
def new_employment_end_date(): | |
def on_success(validated): | |
draft_id = session.get('draft_id') | |
day = validated['new_job_end']['day'] | |
month = validated['new_job_end']['month'] | |
year = validated['new_job_end']['year'] | |
date = "{day}/{month}/{year}".format(**locals()) |
This file contains 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
from datetime import datetime | |
import mandrill | |
def send_email(to_email, to_name, subject, message_text, from_email = '[email protected]', from_name='RPS Exemplar'): | |
#additional message parameters https://mandrillapp.com/api/docs/messages.JSON.html | |
api_key = _MANDRILL_APP_KEY_ | |
try: | |
mandrill_client = mandrill.Mandrill(api_key) |
This file contains 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
"\e[1;3D": backward-word | |
"\e[1;3C": forward-word |
This file contains 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 | |
# | |
# gpgedit: edit an encrypted file with an associated list of recipients | |
# | |
# $ gpgedit secrets.gpg [gpg args] | |
# | |
# gpgedit needs the companion file "secrets.rcp" to exist, and contains a list | |
# of intended recipients, one per line. The recipient file can contain end-of- | |
# line comments, starting with the "#" character. |