Skip to content

Instantly share code, notes, and snippets.

View wmedlar's full-sized avatar

Will Medlar wmedlar

View GitHub Profile
@wmedlar
wmedlar / extract.sh
Created January 8, 2022 03:07
Script to extract images from PDFs with automatic alpha-layer recombination
#!/usr/bin/env bash
# TODO
@wmedlar
wmedlar / README.md
Last active April 24, 2020 19:24
Quick Intro to Kubernetes Resources

Pods, services, deployments... it all sounds the same until you've had the chance to get hands on with it. This will be a short reference to the terminology of Kubernetes resources for a new cluster operator or developer.

Pods

Pods are one or more containers (but usually just one) running together; they are the smallest executable resource in Kubernetes.

Do not use pods directly, they don't scale and cannot be relocated to a different server. Use one of the below abstractions to manage templates of pods.

@wmedlar
wmedlar / octologue.md
Last active January 23, 2020 17:15
Eight Commandments for Kubernetes
  1. Kubernetes is not the solution to every problem.
  2. Kubernetes just runs containers.
  3. Kubernetes shall not manage the persistence layer; prefer hosted services.
  4. Kubernetes Manifests shall be heavily commented to explain cryptic and non-standard usage.
  5. DevOps shall provide a service layer (the Cluster Platform) to improve application visibility.
  6. DevOps shall provide training, documentation, and guidance to Developers learning Kubernetes.
  7. DevOps shall seek to minimize the amount of YAML required to write and maintain Kubernetes Manifests.
  8. DevOps and Developers shall share the burden of maintaining business layer applications.
$ psql -U postgres -h localhost
psql (11.4, server 9.6.13)
Type "help" for help.
postgres=> \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
---------------+-------------------+----------+------------+------------+-----------------------------------------
cloudsqladmin | cloudsqladmin | UTF8 | en_US.utf8 | en_US.utf8 |
destination | postgres | UTF8 | en_US.utf8 | en_US.utf8 |
@wmedlar
wmedlar / README.md
Created November 2, 2018 17:11
Will's Guide to Ingress

Ingress

Background

Every resource type within Kubernetes is managed by a "controller", an application running a watch loop and reacting to changes to the resource it's watching. The controller-manager runs and manages all the built-in controllers, but additional resources (e.g., CRDs) require user-deployed controllers.

Ingress resources are an interesting example, as they're a (the only?) built-in resource type without a built-in controller. Instead Kubernetes distributions often package an ingress controller for their cloud platform (e.g., gce-ingress). By themselves ingress resources are meaningless; it's only that separate ingress controller that makes them real within a cluster.

How It Works

An ingress controller monitors ingress resources for changes (incl. creations and deletions) and up

@wmedlar
wmedlar / crudely-drawn-bell-peppers.jpg
Last active June 20, 2017 21:56
Open-Source Bell Pepper Memes
crudely-drawn-bell-peppers.jpg
@wmedlar
wmedlar / README.md
Created November 30, 2016 21:26
Ralph Lauren bug replication

To reproduce the issue:

  • Serve script.js and index.html with a simple HTTP server.
$ python3 -m http.server
  • Ensure your ad-blocker is disabled and navigate to any page on www.ralphlauren.com. I was able to reproduce the error in Firefox and Chrome.
  • Run bookmarklet.js either as a bookmarklet or in the browser url.
  • The iframe created by script.js sends a message to a listener in index.html once, then is hammered with additional events (due to the bug) with data similar to "{"cxr":true,"id":"de358f9-93588236-068e-9f0c-fe732…le-frame'][1]"],"sid":"7_","sp":{"x":0,"y":6610}}", all of which are logged to the console.
@wmedlar
wmedlar / complex_numbers.ipynb
Created May 9, 2016 20:17
Introduction to Complex Numbers with Python 3
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wmedlar
wmedlar / Self-Consistent Density Functional Theory Calculations with Quantum ESPRESSO.ipynb
Created January 5, 2016 22:00
Silicon, Aluminum, Iron, and Graphene are characterized with a popular Fortran implementation of the self-consistent density functional theory -- Quantum ESPRESSO. An introduction to DFT and using QE is given, and results for Silicon are compared with those of previous calculations using the empirical pseudopotential and tight-binding methods.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wmedlar
wmedlar / Pseudopotential-Derived Band Structure of Silicon.ipynb
Last active July 8, 2024 09:01
The band structure of Silicon is calculated using the empirical pseudopotential method implemented in the Python programming language. A generalized routine is able to calculate the band structure of diamond and zincblende lattices. The energy splittings for Silicon at symmetry points appear to be very accurate with accepted values by diagonaliz…
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.