Skip to content

Instantly share code, notes, and snippets.

@anonymuse
anonymuse / ch_04_picture_grid.py
Last active June 24, 2022 11:41
Automate the Boring Stuff with Python -- Chapter 04 -- Character Picture Grid
'''
SPOILER ALERT! SPOILER ALERT!
Solution ahead
SPOILER ALERT! SPOILER ALERT!
```
grid = [['.', '.', '.', '.', '.', '.'],
['.', 'O', 'O', '.', '.', '.'],
['O', 'O', 'O', 'O', '.', '.'],
['O', 'O', 'O', 'O', 'O', '.'],
@anonymuse
anonymuse / dockernyc_talk.md
Last active November 18, 2018 19:55
Docker NYC Speaker Guidelines

Hello there!

We here at DockerNYC are glad to hear that you are interested in giving a talk at the DockerNYC Meetup. Our meetup is a great place to reach technology enthusiasts who are using containers, leveraging orchestration and scheduling, and considering security, audit and compliance in their workloads.

Here's a description of the sort of talks we're looking for from an organizer's perspective:

  • The talk is hands-on, and demonstrates working functionality in the container ecosystem. A good rule of thumb is that the talk be around 50% demo, and 50% talking / discussion / etc.

  • The speaker is educating the group, as we'd like our members to learn about Docker at every event. Further discussion and education on supporting container ecosystem tools, modern application architecture, and engineering culture and practice is also very welcome.

---
##################################################################################################
# Ratings service
##################################################################################################
apiVersion: v1
kind: Service
metadata:
name: ratings
labels:
app: ratings
@anonymuse
anonymuse / FreeNAS.md
Created July 4, 2017 19:27 — forked from jacobblock/FreeNAS.md
Ultimate FreeNAS Setup

FreeNAS

I started using FreeNAS in August 2013. It is fantastic piece of software and I have been really impressed by the upgrades just in the few months I've been using it. It looks like they recently went to a plugin system as of version 9 to make installing software easier for end users. I've ran into several issues related to plugins and user + group permissions so I decided to just use the available FreeBSD port system. After fiddling for a few days (now turned into months) I believe I have created something helpful for the community and anyone interested in picking up the port system. The sandbox nature of FreeNAS's jail system is especially helpful for playing around without having any consequence on your core system.

Here are straight-forward instructions to setting up a bunch of different software on FreeNAS. If you make a terrible error, just throw up another plugin sandbox and repeat.

ToC

moby-025000000004:/# kubeadm-init.sh
[kubeadm] WARNING: kubeadm is in beta, please do not use it for production clusters.
[init] Using Kubernetes version: v1.6.1
[init] Using Authorization mode: RBAC
[preflight] Skipping pre-flight checks
[preflight] No supported init system detected, won't ensure kubelet is running.
[certificates] Generated CA certificate and key.
[certificates] Generated API server certificate and key.
[certificates] API Server serving cert is signed for DNS names [moby-025000000004 kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 192.168.65.5]
[certificates] Generated API server kubelet client certificate and key.
$ make build-vm-images
../../bin/moby build -name kube-master kube-master.yml
Extract kernel image: linuxkit/kernel:4.9.x
Add init containers:
Process init image: linuxkit/init:63eed9ca7a09d2ce4c0c5e7238ac005fa44f564b
Process init image: linuxkit/runc:b0fb122e10dbb7e4e45115177a61a3f8d68c19a9
Process init image: linuxkit/containerd:18eaf72f3f4f9a9f29ca1951f66df701f873060b
Process init image: linuxkit/ca-certificates:e091a05fbf7c5e16f18b23602febd45dd690ba2f
Add onboot containers:
Create OCI config for linuxkit/sysctl:1f5ec5d5e6f7a7a1b3d2ff9dd9e36fd6fb14756a
$ make
mkdir -p bin
tar cf - vendor src/initrd src/pad4 -C src/cmd/moby . | docker run --rm --net=none --log-driver=none -i -e GOOS=darwin -e GOARCH=amd64 linuxkit/go-compile:4513068d9a7e919e4ec42e2d7ee879ff5b95b7f5@sha256:bdfadbe3e4ec699ca45b67453662321ec270f2d1a1dbdbf09625776d3ebd68c5 --package github.com/linuxkit/linuxkit --ldflags "-X main.GitCommit=d35878c9e8c428d9b47eca16787d8267a2a9297c -X main.Version="0.0" " -o bin/moby > tmp_moby_bin.tar
Unable to find image 'linuxkit/go-compile:4513068d9a7e919e4ec42e2d7ee879ff5b95b7f5@sha256:bdfadbe3e4ec699ca45b67453662321ec270f2d1a1dbdbf09625776d3ebd68c5' locally
sha256:bdfadbe3e4ec699ca45b67453662321ec270f2d1a1dbdbf09625776d3ebd68c5: Pulling from linuxkit/go-compile
627beaf3eaaf: Pulling fs layer
1b3a1005911c: Pulling fs layer
d58e6f1740ab: Pulling fs layer
49418cbb2668: Pulling fs layer
49418cbb2668: Waiting
@anonymuse
anonymuse / create_swarm_cluster.sh
Created February 6, 2017 16:48 — forked from alexei-led/create_swarm_cluster.sh
Deploy Docker Compose (v3) to Swarm (mode) Cluster
#!/bin/bash
# vars
[ -z "$NUM_WORKERS" ] && NUM_WORKERS=3
# init swarm (need for service command); if not created
docker node ls 2> /dev/null | grep "Leader"
if [ $? -ne 0 ]; then
docker swarm init > /dev/null 2>&1
fi
@anonymuse
anonymuse / create_cluster.sh
Last active December 30, 2016 23:34
Docker Kata 005 cluster creation script.
#!/usr/bin/env bash
#
# Purpose: Create a Swarm Mode cluster with a single master and a configurable
# number of workers.
# This script is a mirror of the following gist, which is used to
# populate a Medium story. Unfortunately, there's no way to synchronize all
# three
#
# Medium: https://medium.com/contino-io/docker-kata-005-ac8429082f6c
# Gist: https://gist.github.com/anonymuse/502e7bf5c7b67bb95a4250cdccbc5125
WOPR:~ jesse$ minikube start --kubernetes-version="v1.5.1" --vm-driver="virtualbox" --show-libmachine-logs --alsologtostderr
W1224 10:30:26.467829 2747 root.go:139] Error reading config file at /Users/jesse/.minikube/config/config.json: open /Users/jesse/.minikube/config/config.json: no such file or directory
Starting local Kubernetes cluster...
Running pre-create checks...
Creating machine...
(minikube) Downloading /Users/jesse/.minikube/cache/boot2docker.iso from file:///Users/jesse/.minikube/cache/iso/minikube-0.7.iso...
(minikube) Creating VirtualBox VM...
(minikube) Creating SSH key...
(minikube) Starting the VM...
(minikube) Check network to re-create if needed...