Skip to content

Instantly share code, notes, and snippets.

@evilensky
evilensky / falsehoods-programming-time-list.md
Created August 18, 2023 01:23 — forked from timvisee/falsehoods-programming-time-list.md
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@evilensky
evilensky / aws-lambda-relative-import-no-known-parent-package.md
Created October 24, 2022 22:12 — forked from gene1wood/aws-lambda-relative-import-no-known-parent-package.md
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
@evilensky
evilensky / Scrape-BoxOfficeMojo-Notebook.ipynb
Created February 7, 2022 00:06 — forked from codingforentrepreneurs/Scrape-BoxOfficeMojo-Notebook.ipynb
Scrape & Save Data from Box Office Mojo (Educational)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@evilensky
evilensky / aws_cli_paginator.sh
Created October 29, 2021 14:52 — forked from marjamis/aws_cli_paginator.sh
A simple sample of running the AWS CLI which will take consideration of pagination to get all results.
#!/bin/bash -xe
# Below command can be replaced to the required CLI, including with custom JSON output, assuming the NextToken is in the same location.
AWS_CLI_COMMAND="aws elasticbeanstalk list-platform-versions --max-records 100 --query={NextToken:NextToken,PlatformARNs:PlatformSummaryList[*].PlatformArn}"
OUTPUT_FILE="./output-$(date +%s)"
function CLI_call() {
if [ ! -v NEXT_TOKEN ]; then
cli_output=$($AWS_CLI_COMMAND)
else
@evilensky
evilensky / selfsigned.py
Created October 18, 2021 12:08 — forked from bloodearnest/selfsigned.py
Create a self-signed x509 certificate with python cryptography library
# Copyright 2018 Simon Davy
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
@evilensky
evilensky / kubernetes-war.md
Created September 28, 2021 17:04 — forked from cgswong/kubernetes-war.md
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
@evilensky
evilensky / diagrams.md
Created September 22, 2021 21:43 — forked from blackcater/diagrams.md
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.

@evilensky
evilensky / graphql_example.py
Created August 5, 2021 22:17 — forked from gbaman/graphql_example.py
An example on using the Github GraphQL API with Python 3
# An example to get the remaining rate limit using the Github GraphQL API.
import requests
headers = {"Authorization": "Bearer YOUR API KEY"}
def run_query(query): # A simple function to use requests.post to make the API call. Note the json= section.
request = requests.post('https://api.github.com/graphql', json={'query': query}, headers=headers)
if request.status_code == 200:
@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
@evilensky
evilensky / gist:801abfe11a4412e34b597436eddd3656
Created July 26, 2020 20:31 — forked from prziborowski/gist:ba3ebf610dd6cca3f4e7be5e2874499f
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.