Skip to content

Instantly share code, notes, and snippets.

View jberkus's full-sized avatar
💭
Catching up and prepping for Kubecon Shanghai

Josh Berkus jberkus

💭
Catching up and prepping for Kubecon Shanghai
View GitHub Profile
Potential ordering for F27 Blog Posts
Tuesday: Release announcement/summary
Tuesday: 26->27 Migration post
Wednesday: Migrating Kubernetes post
Thursday: Multi-arch (both on blog and on Magazine)
FROM fedora:25
MAINTAINER Josh Berkus "josh@agliodbs.com"
LABEL Usage="docker run -d -P --tmpfs /run --tmpfs /tmp -v /sys/fs/cgroup:/sys/fs/cgroup pgadmin4"
ENV container=oci
# install packages
RUN dnf install -y https://download.postgresql.org/pub/repos/yum/9.6/fedora/fedora-25-x86_64/pgdg-fedora96-9.6-3.noarch.rpm && \
@jberkus
jberkus / gist:75168b0c0cd3656c4fd8f57d1a3028ba
Created February 10, 2017 22:36
Example for ostree update
As an example, let's say that we have a Fedora Atomic host which is on the default ref. That ostree will now be updated every two weeks, and only every two weeks:
```
-bash-4.3# date
Fri Feb 10 21:05:27 UTC 2017
-bash-4.3# rpm-ostree status
State: idle
Deployments:
● fedora-atomic:fedora-atomic/25/x86_64/docker-host
@jberkus
jberkus / gist:a4457d40a758f7eca1e8
Created August 11, 2015 23:33
fake clickstream data generator
#!/user/bin/env python
import psycopg2
import datetime
import random
import time
import sys
def randuser():
return (int(random.random() * 100) + 1)
@jberkus
jberkus / download_issues.py
Last active December 6, 2016 00:46
Simple script for downloading all of a project's github issues into a PostgreSQL database
#!/usr/bin/env python
# Usage: download_issues.py owner repo postgres_dsn github_token
# simple script for downloading all issues from the given repository
# requires you to set up an API token with no special permissions
# also requires a PostgreSQL database with the following tables:
"""
create table issues (
Nov 22 22:06:57 ip-172-31-36-35.us-west-2.compute.internal oci-systemd-hook[9680]: systemdhook <debug>: Skipping as container command is /usr/local/bin/kube-controller-manager, not init or systemd
Nov 22 22:06:57 ip-172-31-36-35.us-west-2.compute.internal kubelet[8942]: I1122 22:06:57.998626 8942 factory.go:111] Using factory "docker" for container "/system.slice/docker-ba0c74e340d3795cd0d490cbad0b4135
Nov 22 22:06:58 ip-172-31-36-35.us-west-2.compute.internal systemd[1]: libcontainer-9684-systemd-test-default-dependencies.scope: Scope has no PIDs. Refusing.
Nov 22 22:06:58 ip-172-31-36-35.us-west-2.compute.internal systemd[1]: libcontainer-9684-systemd-test-default-dependencies.scope: Scope has no PIDs. Refusing.
Nov 22 22:06:58 ip-172-31-36-35.us-west-2.compute.internal kubelet[8942]: I1122 22:06:58.046995 8942 server.go:608] Event(api.ObjectReference{Kind:"Pod", Namespace:"kube-system", Name:"kube-controller-manager
Nov 22 22:06:58 ip-172-31-36-35.us-west-2.compute.internal kernel: XFS (dm-8): Mounti
@jberkus
jberkus / containers_and_dbs.txt
Last active October 15, 2016 19:22
Notes from Containers & Databases session at ContainerDays Austin
containers & databases
======================
databases
---------
* postgres
* mysql & mariadb
* oracle
* redis
install
reboot
lang en_US.UTF-8
keyboard us
timezone --utc America/Los_Angeles
selinux --enforcing
zerombr
clearpart --all --initlabel
bootloader --location=mbr --boot-drive=sda
reqpart --add-boot
@jberkus
jberkus / atomic-ks.cfg
Created August 31, 2016 00:47
Sample Kickstart for Atomic on Minnowboard
```
# install Fedora Atomic and then reboot automatically
install
reboot
# set language, keyboard and timezone
lang en_US.UTF-8
keyboard us
timezone --utc America/Los_Angeles
@jberkus
jberkus / xlog_numeric_location.sql
Last active February 20, 2016 20:30
Determine Most Caught-up Standby
-- For documentation on these functions, please see blog post at:
-- http://www.databasesoup.com/2012/10/determining-furthest-ahead-replica.html
-- determines current xlog location as a monotonically increasing numeric.
CREATE OR REPLACE FUNCTION xlog_location_numeric(vcloc text default NULL)
RETURNS numeric
LANGUAGE plpgsql
as $f$
DECLARE cloc text;
floc text[];