Skip to content

Instantly share code, notes, and snippets.

@rhettinger
rhettinger / mymax10e.py
Created November 18, 2021 01:50
Type annotated pure python implementation of the builtin max() function
'Emulate max() as fully as possible in pure Python.'
# https://stackoverflow.com/questions/69997857/implementation-of-max-function-in-python/69997876#69997876
# https://github.com/python/mypy/issues/7231
from typing import TypeVar, Any, Iterator, Iterable, Optional
from typing import Union, Protocol, Callable, cast, Tuple, overload
class SupportsGT(Protocol):
@driscollis
driscollis / vehicle.py
Created October 13, 2021 13:34
Type hinting quiz
# vehicle.py
from collections import namedtuple
class Vehicle:
def __init__(self, name, veh_type):
self.name = name
self.veh_type = veh_type
self.add_ons = []
@codingforentrepreneurs
codingforentrepreneurs / Scrape-BoxOfficeMojo-Notebook.ipynb
Last active January 22, 2024 08:23
Scrape & Save Data from Box Office Mojo (Educational)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@evilensky
evilensky / kemp-cert-update.sh
Created December 10, 2020 23:43 — forked from colinwilson/kemp-cert-update.sh
Bash script to update certificates on KEMPs Loadmaster Load balancer via pfSense's ACME package.
#!/bin/sh
#
# Title: Auto-Update & Upload LetsEncrypt Certs to KEMP LoadMaster
# Guide/Source: https://colinwilson.uk/2017/06/19/auto-update-ssl-certificates-on-kemp-loadmaster-via-pfsense--lets-encrypt/
# Created: 12/06/2017
# Author: Colin Wilson @colinwilson
# Vendor or Software Link: https://www.pfsense.org/ , https://kemptechnologies.com
# Version: 1.1.0
# Category: BASH Shell Script
@cgswong
cgswong / kubernetes-war.md
Created January 27, 2020 21:09
Kubernetes Well Architected Review

Kubernetes Well Architected Review (WAR)

Customer: Midas Touch

Date: February 02, 2020

tags: meeting kubernetes EKS WAR

Intent:

  • Increase awareness of architectural best practices
@gene1wood
gene1wood / aws-lambda-relative-import-no-known-parent-package.md
Last active July 9, 2024 11:09
Python relative imports in AWS Lambda fail with `attempted relative import with no known parent package`

Python relative imports in AWS Lambda fail with attempted relative import with no known parent package

The Problem

In AWS Lambda if I attempt an explicit relative import like this

.
├── lambda_file.py
└── example.py
@prziborowski
prziborowski / gist:ba3ebf610dd6cca3f4e7be5e2874499f
Last active July 16, 2023 00:42
Use property collector to retrieve names quickly
#!/usr/bin/env python
"""
Written by Nathan Prziborowski
Github: https://github.com/prziborowski
This code is released under the terms of the Apache 2
http://www.apache.org/licenses/LICENSE-2.0.html
The property collector can be used to fetch a subset of properties
for a large amount of objects with fewer round trips that iterating.
This sample shows how to use the TraversalSpec to get properties
of another object without multiple calls.
@cleverdevil
cleverdevil / overcast-recently-played.py
Last active March 4, 2024 09:28
Fetch recently played episodes from Overcast.fm. Then, publish history to my website.
'''
You'll need to pip install some dependencies:
* python-dateutil
* requests
Also, populate your EMAIL and PASSWORD below.
'''
from xml.etree import ElementTree
@blackcater
blackcater / diagrams.md
Created July 6, 2018 16:45
Markdown Diagrams

Diagrams

Markdown Preview Enhanced supports rendering flow charts, sequence diagrams, mermaid, PlantUML, WaveDrom, GraphViz, Vega & Vega-lite, Ditaa diagrams. You can also render TikZ, Python Matplotlib, Plotly and all sorts of other graphs and diagrams by using Code Chunk.

Please note that some diagrams don't work well with file exports such as PDF, pandoc, etc.

Flow Charts

This feature is powered by flowchart.js.

@colinwilson
colinwilson / kemp-cert-update.sh
Created June 30, 2018 14:46
Bash script to update certificates on KEMPs Loadmaster Load balancer via pfSense's ACME package.
#!/bin/sh
#
# Title: Auto-Update & Upload LetsEncrypt Certs to KEMP LoadMaster
# Guide/Source: https://colinwilson.uk/2017/06/19/auto-update-ssl-certificates-on-kemp-loadmaster-via-pfsense--lets-encrypt/
# Created: 12/06/2017
# Author: Colin Wilson @colinwilson
# Vendor or Software Link: https://www.pfsense.org/ , https://kemptechnologies.com
# Version: 1.1.0
# Category: BASH Shell Script