Skip to content

Instantly share code, notes, and snippets.

View haikoschol's full-sized avatar

Haiko Schol haikoschol

View GitHub Profile
@haikoschol
haikoschol / ort-server-prod-deployment.md
Last active May 2, 2024 09:21
ORT Server Production Deployment Braindump

Requirements

  • deploy every infra component in a HA configuration
  • store all infra-related secrets in Vault
  • use short lived secrets wherever possible
  • enable rotating all long-lived secrets with a high degree of automation
  • as much as possible, make each infra component optional (i.e. support using RDS for PostgreSQL, managed Prometheus, etc.)
  • use k8s operators where appropriate (e.g. zalando/postgres-operator, artemiscloud/activemq-artemis-operator)
  • monitor all infra components with Prometheus
  • keep audit trail of any secret access and other security relevant activity
@haikoschol
haikoschol / gist:bbedf557272a0ec5707afba7ab6e6a0b
Created May 2, 2024 09:12
ORT Server Production Deployment Braindump
Requirements
- deploy every infra component in a HA configuration
- store all infra-related secrets in Vault
- use short lived secrets wherever possible
- enable rotating all long-lived secrets with a high degree of automation
- as much as possible, make each infra component optional (i.e. support using RDS for PostgreSQL, managed Prometheus, etc.)
- use k8s operators where appropriate (e.g. zalando/postgres-operator, artemiscloud/activemq-artemis-operator)
- monitor all infra components with Prometheus
- keep audit trail of any secret access and other security relevant activity
@haikoschol
haikoschol / foo.rs
Last active September 9, 2020 14:03
Rust async closure
// Make a function that authenticates a Github user by checking that they are part of the
// given Github organisation.
fn make_auth_fn(
github_bot: &GithubBot,
username: &str,
org: &str,
repo_name: &str,
pr_number: i64,
) -> Box<dyn Fn() -> Result<()>> {
Box::new(async || {
@haikoschol
haikoschol / rubysec.py
Created January 20, 2020 16:58
Fetch, extract and parse rubysec advisory zip file without disk I/O
from io import BytesIO
from urllib.request import urlopen
import yaml
from zipfile import ZipFile
RUBYSEC_DB_URL = 'https://github.com/rubysec/ruby-advisory-db/archive/master.zip'
def rubygem_advisories(url, prefix='ruby-advisory-db-master/gems/'):
@haikoschol
haikoschol / scancode_ide_setup.md
Last active November 17, 2017 14:47
ScanCode IDE setup

IDE Configuration

PyCharm

Open the settings dialog and navigate to "Project Interpreter". Click on the gear button in the upper left corner and select "Add Local". Find the python binary in the virtualenv (bin/python in the repository root) and confirm. Open a file that contains tests and set a breakpoint. Right click in the test and select "Debug <name of test>". Afterwards you can re-run the same test in the debugger using the appropriate keyboard shortcut (e.g. Shift-F9, depending on platform and configured layout).

Visual Studio Code

from collections import defaultdict
S = 'sports'
P = 'politics'
E = 'economics'
T = 'travel'
F = 'fashion'
class Article(object):
def __init__(self, content, category):
@haikoschol
haikoschol / .gitignore
Created October 9, 2012 07:42 — forked from adamgit/.gitignore
.gitignore file for Xcode4 / OS X Source projects
#########################
# .gitignore file for Xcode4 / OS X Source projects
#
# NB: if you are storing "built" products, this WILL NOT WORK,
# and you should use a different .gitignore (or none at all)
# This file is for SOURCE projects, where there are many extra
# files that we want to exclude
#
# For updates, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#########################
@haikoschol
haikoschol / widgets.py
Created May 24, 2012 15:07
workaround for a regression in Django 1.4 which makes forms with fields of type BooleanField non-picklable
"""
Copyright (c) Django Software Foundation and individual contributors.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
//
// NSURL+PathParameters.h
//
// Created by Johan Kool on 27/9/2011.
// Copyright 2011 Koolistov Pte. Ltd. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are
// permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice, this list of
@haikoschol
haikoschol / gist:2291711
Created April 3, 2012 12:48
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after