Skip to content

Instantly share code, notes, and snippets.

View AndreSteenveld's full-sized avatar

Andre Steenveld AndreSteenveld

View GitHub Profile
@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 / 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 / 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 / 010-common.yml
Created August 27, 2020 08:12
ytt templates split over multiple files
version: "3.7"
@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 / 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 26, 2020 13:56
The YTT experiments
version: '3.7'
---
#@ load( "@ytt:overlay", "overlay" )
#@overlay/match by=overlay.all
#@overlay/match-child-defaults missing_ok=True
---
#@overlay/assert
version: '3.7'
@AndreSteenveld
AndreSteenveld / sr
Last active October 28, 2021 08:05
Flatten multiple tar files in to a single tar file
#!/usr/bin/env bash
set -e
declare entrypoint="" ; entrypoint=$( readlink -f "${BASH_SOURCE[0]}" 2>/dev/null || echo "$0" )
sr_steam_roller() {
@AndreSteenveld
AndreSteenveld / update-hosts.sh
Last active January 19, 2020 09:07 — forked from mpneuried/update-hosts.sh
A small shell script that will add and remove lines from the hosts file. Originally created by Claus Witt, http://clauswitt.com/319.html.
#! /bin/sh
# @author: Claus Witt
# http://clauswitt.com/319.html
# Adding or Removing Items to hosts file
# Use -h flag for help
DEFAULT_IP=127.0.0.1
IP=${3:-$DEFAULT_IP}
@AndreSteenveld
AndreSteenveld / poor-cow.sh
Created November 30, 2017 12:01
Poor man's COW
#!/bin/bash
# Exit if something totally fails
set -e
source_directroy="$( readlink -e $1 )"
target_directory="$( readlink -e $2 )"
overlay_directory="$( readlink -e $3 )"
df --output=target | grep "$target_directory" | xargs -L1 umount -f