Skip to content

Instantly share code, notes, and snippets.

View AndreSteenveld's full-sized avatar

Andre Steenveld AndreSteenveld

View GitHub Profile
@AndreSteenveld
AndreSteenveld / expected-output.txt
Last active August 26, 2020 20:31
How would I do a mixin?
version: "3.7"
services:
cool-container:
beverages:
- Mate
- Coffee
- Tea
- Water
labels:
- cold
@AndreSteenveld
AndreSteenveld / input.yml
Last active August 27, 2020 11:06
Work around for YTT mixins
version: "3.7"
---
#@ load( "@ytt:template", "template" )
#@ def init_bash_shell( service_name ):
#@overlay/match by=overlay.all
#@overlay/match-child-defaults missing_ok=True
---
services:
@AndreSteenveld
AndreSteenveld / 010-common.yml
Created August 27, 2020 08:12
ytt templates split over multiple files
version: "3.7"
@AndreSteenveld
AndreSteenveld / Mixin.yaml
Last active September 3, 2020 09:54
More mixing with YTT
version: "1.0"
---
#@ load( "@ytt:overlay", "overlay" )
#@ load( "@ytt:template", "template" )
---
#@ def _mixin_array( path, value ):
#@ if path[ 0 ].endswith( "prefix" ):
@AndreSteenveld
AndreSteenveld / experiment.dhall
Last active September 17, 2020 11:49
Dhall folding types
let default_list = https://prelude.dhall-lang.org/List/default
let combiner
: forall ( T : Type ) -> forall ( default : T ) -> forall ( combine : T -> T -> T ) -> ( T -> T -> T )
=
\( T : Type ) -> \( default : T ) -> \( combine : T -> T -> T ) ->
\( left : T ) -> \( right : T ) ->
-- The following expression is what would make this work but unfortunaly it doesn't for
-- it seems that to make this work something called row polymorphism is needed. The error
-- you'd get when running this is the compiler saying the types of left and right are not
@AndreSteenveld
AndreSteenveld / list like records.dhall
Created September 19, 2020 12:00
Dhall experiments
let L = {
, Type = List Text
, default = [ "First", "Second" ]
}
in {
, the_default = L.default
, thing = [ "bloop", "bleep" ] : L.Type
-- Error : "You can only override records"
@AndreSteenveld
AndreSteenveld / jsonnet
Last active November 4, 2020 10:56
Using the jsonnet docker image
#! /usr/bin/env bash
# The script wraps around the jsonnet docker image to so it can be run without installing
# python locally. This script is also geared towards a windows setup as it currently is
# environment I'm working in. With the exception of the TTY wrappers I think this should
# generally work for any *nix system as well.
#
# Clearly access to a docker host is required to make this work... For a windows setup
# we will also be assuming that all the relevant drives (C, D, whatever) are mounted on
# the docker host under "/c", "/d", etc.
@AndreSteenveld
AndreSteenveld / Dockerfile
Last active October 9, 2020 13:24
Self contained docker registry
# syntax = docker/dockerfile:experimental
#
# A self contained docker registry
#
# Why? - I needed a way to transport multiple images and some tooling between different machines
# which would all have a docker daemon running on them. Packaging everything in to a single
# registry gives me a convinent package while also minimising my interactions with the target machine.
#
# How? - In a nutshell what is happening is that we start with a bootstrap registry in which we will
@AndreSteenveld
AndreSteenveld / winpty
Created December 10, 2020 15:15
winpty stub for nix
#!/usr/bin/env bash
eval "$@" <(cat)
#
# Every now and then I have to write scripts which will work from git-bash as well as a proper *nix
# system. Adding this on my *nix system helps with the strangeness which is git-bash. All we would
# like to do here is redirect all the stdin, out and err "like winpty does" on a windows system.
#
# Clearly on *nix there is no need to translate between tty and the terminal serivice on windows.
#
@AndreSteenveld
AndreSteenveld / INSTALL.md
Created April 20, 2021 21:08
Installing pacman on git for windows

Why?

I recently made a fresh install of windows and all the tools I needed to develop software including git-for-windows. Unfortunatnly git-for-windows doesn't come with a packagemanager buildt in and going full cygwin seems a little overkill. After some research I ran in to this post on stackoverflow describing a way to install pacman in to git-for-windows. Unfortuntly only "most of it" worked in my case. This document attempts to describe the entire process I went through to install pacman.

Prepare

The packages in the MSYS2 repositoy seem to be packaged using zstd now and not xz as described. Obviously it would be great to use a package manager to install zstd and un-tar the files... Given that this guide is geared towards windows installs you can install 7zip and add the Modern7z plugins to unpack zstd files.

Downloading and unpacking the neccesary packages