Skip to content

Instantly share code, notes, and snippets.

View julianpistorius's full-sized avatar

Julian Pistorius julianpistorius

View GitHub Profile

microstack + microk8s

Problem: with both microk8s and microstack installed, the k8s' nginx server is started on the default port (8080)

Solution: Changing the default port for Horizon to 5001

sudo snap set microstack config.network.ports.dashboard=5001
sudo snap restart microstack

Additional notes: MySQL and RabbitMQ ports can also be changed similarly

@julianpistorius
julianpistorius / design-by-contract.py
Last active March 16, 2021 17:54
Simplistic 'design-by-contract' example in Python
def add(x, y):
# Precondition
assert isinstance(x, int), 'x is not an integer'
assert isinstance(y, int), 'y is not an integer'
answer = x + y
# Postcondition
assert isinstance(answer, int), 'answer is not an integer'
@julianpistorius
julianpistorius / Architecture.md
Created November 29, 2019 22:47 — forked from evancz/Architecture.md
Ideas and guidelines for architecting larger applications in Elm to be modular and extensible

Architecture in Elm

This document is a collection of concepts and strategies to make large Elm projects modular and extensible.

We will start by thinking about the structure of signals in our program. Broadly speaking, your application state should live in one big foldp. You will probably merge a bunch of input signals into a single stream of updates. This sounds a bit crazy at first, but it is in the same ballpark as Om or Facebook's Flux. There are a couple major benefits to having a centralized home for your application state:

  1. There is a single source of truth. Traditional approaches force you to write a decent amount of custom and error prone code to synchronize state between many different stateful components. (The state of this widget needs to be synced with the application state, which needs to be synced with some other widget, etc.) By placing all of your state in one location, you eliminate an entire class of bugs in which two components get into inconsistent states. We also think yo

Keybase proof

I hereby claim:

  • I am julianpistorius on github.
  • I am julianpistorius (https://keybase.io/julianpistorius) on keybase.
  • I have a public key ASDsBph-7ZMdJl0_5QatK6PNBfIQxk9FN93yh87VdLC8cwo

To claim this, I am signing this object:

@julianpistorius
julianpistorius / too_afraid.md
Created October 1, 2019 03:10 — forked from mootpointer/too_afraid.md
Too Afraid to Try

Too afraid to try: Innovation is impossible without psychological safety

Innovation and creativity are inextricably linked. However, in the murky waters of ambiguity we often lose our way. We cling to what is known and what is safe, and create environments where accountability and preserving the status quo trumps the potential gains of innovation. For us to truly innovate, we need to foster environments of psychological safety: where we are certain about some things so we can embrace the uncertainty of others. In this session we will dig into research, some stories from the trenches and best practices to find how we can unlock innovation and creativity through creating a place where your team feels safe to try.

Resources

Books

The Fearless Organisation - Amy Edmondson: A book from the researcher who brought psychological safety to the fore. Brings stories of what psychological safety looks like (and

@julianpistorius
julianpistorius / Dockerfile
Last active August 30, 2019 20:32
Dockerfile to build pylibseq
FROM opensciencegrid/osgvo-ubuntu-18.04:latest
#maintainer "Ariella Gladstein <aglad@med.unc.edu>"
#organization "University of North Carolina at Chapel Hill"
#department "Genetics"
#date "30 Auguest 2019"
#application "pylibseq, for calculating population genetic statistics on genotype data"
RUN apt-get update && apt-get install -y --no-install-recommends \
@julianpistorius
julianpistorius / docker.org
Created August 26, 2019 18:21 — forked from ashiklom/docker.org
PNNL PEcAn setup

PIC setup notes

VM instance setup

Start at cloud management console (https://dashboard.cloud.pnnl.gov).

Go to “Instances”, then “Launch Instance”.

Details: Give it a name (e.g. “pecan1”) Availability zone “nova” (only option).

@julianpistorius
julianpistorius / saas_metrics.sql
Created June 21, 2019 16:46 — forked from arikfr/saas_metrics.sql
SaaS Metrics Query
/*
Explanation of what's going on in this query can be found in this blog post: https://blog.redash.io/sql-query-to-calculate-saas-metrics-dd25d72a0521.
*/
WITH v_charges AS (
SELECT org_id,
date_trunc('month', start_date) AS month,
coalesce((extra::json->>'amount')::float, (extra::json->>'charged_amount')::integer/100) as total
FROM charges
WHERE extra::json->>'months' = '1'
@julianpistorius
julianpistorius / Containerfile
Created May 4, 2018 23:22 — forked from max-mapper/Containerfile
CALeDNA container (build with npm i mkcontainer -g)
ENV NSPAWN_BOOTSTRAP_IMAGE_SIZE=10GB
FROM ubuntu:xenial
# set unlimited bash history
# nspawn needs resolv.conf to be set up for internet to work
# password gets changed so we can login later
RUN mkdir /usr/local/anacapa && \
cd /usr/local/anacapa && \
echo "export HISTFILESIZE=" >> .bashrc && \
echo "export HISTSIZE=" >> .bashrc && \

So, as I mentioned last time, I have two fundamental goals with dat that are not addressed by simply running dat share.

  • Uptime: making sure that the site is seeded even if my local laptop is closed, eaten by a bear, or disconnected from the internet
  • Resilience: ensuring that there's a way to restart my website if the original seeding computer is lost. I try to make everything on my primary work/personal computer work in such a way that I can recover it all, easily, onto a new machine if I need to

To break these down a bit more, uptime is a combination of two things:

  • Ensuring that there are seeders
  • Ensuring that those seeders are seeding, and they're up-to-date