Skip to content

Instantly share code, notes, and snippets.

class NewspaperStyle:
def __init__(self, paper, brain, evaluator):
self._paper = paper
self._brain = brain
def read_newspaper(self):
self._read_news()
self._read_travel()
self._read_sports()
self._read_funnies()
@adambom
adambom / after.py
Last active September 5, 2018 21:31
class ImageProcessor:
def __init__(
self,
image: Image,
image_resizer: ImageResizer,
image_grayscale_converter: ImageGrayscaleConverter,
image_rotator: ImageRotator,
):
self._image = image
self._resizer = image_resizer
def save_sales_entries(form_values):
sanitized_form_values = sanitize_form_values(form_values)
validate_form_values(sanitized_form_values, raise_exeption=True)
normalized_sales_entries = normalize_form_entries(
sanitized_form_values.entries
)
return sales_api.enter_monthly_sales(normalized_sales_entries)
@adambom
adambom / graphql.js
Created December 4, 2017 17:52
Place these files into the same directory
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
@adambom
adambom / README.md
Last active May 27, 2024 07:51
Backup Kubernetes Cluster State

Run this in order to backup all you k8s cluster data. It will be saved in a folder bkp. To restore the cluster, you can run kubectl apply -f bkp.

Please note: this recovers all resources correctly, including dynamically generated PV's. However, it will not recover ELB endpoints. You will need to update any DNS entries manually, and manually remove the old ELB's.

Please note: This has not been tested with all resource types. Supported resource types include:

  • services
  • replicationcontrollers
  • secrets
  • deployments
  • horizontal pod autoscalers
// Pacakge msgme implements a lightweight library for publishing messages to and
// consuming messages from an amqp-compatible message queue.
package msgme
import (
"github.com/streadway/amqp"
)
type Broker struct {
@adambom
adambom / update.js
Created December 7, 2015 20:13
Looker Downtime
looker_global_messages([{message: "Looker will be down for an upgrade for approximately 5 minutes at 5pm PST on 12/17/15."}])
looker_global_messages([{message: "Grid outage around 12AM PDT on 10/19 is causing delays in Mobile and Video data (all tables). Issue is resolved and Sputnik should be up to date by 4-5 PM PDT on 10/19."}])
@adambom
adambom / announce-2015-09-16.js
Created September 16, 2015 16:53
announce-2015-09-16.js
looker_global_messages([{message: "All data currently delayed to an outage in Benzene"}])
@adambom
adambom / test.js
Last active September 2, 2015 21:59
sendMessages([{message: "System working"}, {message: "All systems go"}])