Skip to content

Instantly share code, notes, and snippets.

View FredrikAugust's full-sized avatar
🦦
Otters enjoy spending time in water.

Fredrik A. Madsen-Malmo FredrikAugust

🦦
Otters enjoy spending time in water.
View GitHub Profile
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"argoproj.io/v1alpha1","kind":"Rollout","metadata":{"annotations":{},"labels":{"app.kubernetes.io/component":"init-read","app.kubernetes.io/instance":"init-init-read","app.kubernetes.io/managed-by":"Helm","app.kubernetes.io/name":"init-init-read","app.kubernetes.io/part-of":"init","argocd.argoproj.io/instance":"init-init-read","helm.sh/chart":"init-0.1.0"},"name":"init-init-read","namespace":"init"},"spec":{"progressDeadlineAbort":true,"progressDeadlineSeconds":600,"replicas":2,"revisionHistoryLimit":4,"selector":{"matchLabels":{"app":"init-init-read"}},"strategy":{"canary":{"canaryService":"init-read-canary","dynamicStableScale":true,"stableService":"init-read","steps":[{"setCanaryScale":{"weight":50}},{"setWeight":50}],"trafficRouting":{"smi":{}}}},"template":{"metadata":{"annotations":{"config.linkerd.io/proxy-await":"enabled","instrumentation.opentelemetry.io/
apiVersion: argoproj.io/v1alpha1
kind: Rollout
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: >
{"apiVersion":"argoproj.io/v1alpha1","kind":"Rollout","metadata":{"annotations":{},"labels":{"app.kubernetes.io/component":"manual","app.kubernetes.io/instance":"init-manual","app.kubernetes.io/managed-by":"Helm","app.kubernetes.io/name":"init-manual","app.kubernetes.io/part-of":"init","helm.sh/chart":"init-0.1.0"},"name":"init-manual","namespace":"init"},"spec":{"replicas":1,"revisionHistoryLimit":4,"selector":{"matchLabels":{"app":"init-manual"}},"strategy":{"blueGreen":{"activeService":"manual","previewService":"manual-preview"}},"template":{"metadata":{"annotations":{"config.alpha.linkerd.io/proxy-wait-before-exit-seconds":"10","config.linkerd.io/proxy-await":"enabled","instrumentation.opentelemetry.io/container-names":"init","instrumentation.opentelemetry.io/inject-nodejs":"otel/init-instrumentation","linkerd.io/inject":"enabled"},"labels":{"app":"init-manual","linkerd.io/
@FredrikAugust
FredrikAugust / devops_best_practices.md
Created January 26, 2023 09:45 — forked from jpswade/devops_best_practices.md
Devops Best Practices Checklist

Find the original here article here: Devops Best Practices

DevOps started out as "Agile Systems Administration". In 2008, at the Agile Conference in Toronto, Andrew Shafer posted an offer to moderate an ad hoc "Birds of a Feather" meeting to discuss the topic of "Agile Infrastructure". Only one person showed up to discuss the topic: Patrick Debois. Their discussions and sharing of ideas with others advanced the concept of "agile systems administration". In that same year, Debois and Shafer formed an Agile Systems Administrator group on Google, with limited success. Patrick Debois did a presentation called "Infrastructure and Operations" addressing issues around involving more of the comp

@FredrikAugust
FredrikAugust / useIsPrinting.ts
Last active January 29, 2024 19:17
Custom React hook for listening to whether or not the window is currently printing.
/**
* Allows you to subscribe to whether or not the window is currently printing (user invoked the system print dialog).
*
* @returns Whether or not the document is currently printing.
*/
export default function useIsPrinting(): boolean {
const [printing, setIsPrinting] = useState(
window.matchMedia('print').matches
);
@FredrikAugust
FredrikAugust / useFetch.ts
Last active September 3, 2021 11:46
useFetch with cancellation token
import { useEffect, useState } from 'react';
export type UseFetchReturnType<T> = {
loading: boolean;
data?: T;
error?: Error;
};
type FetchParameters = Parameters<typeof fetch>;
@FredrikAugust
FredrikAugust / yahtzee.hs
Created November 11, 2020 16:51
Maximum possible score in first row of Yahtzee
module Yahtzee where
import Data.List (group, maximumBy, sortBy)
yahtzee_upper :: [Int] -> Int
yahtzee_upper numbers =
sum
. maximumBy (\x x' -> compare (sum x) (sum x'))
. group
. sortBy (compare)
import React from 'react';
interface User {
id: number;
email: string;
first_name: string;
last_name: string;
avatar: string;
}
@FredrikAugust
FredrikAugust / main.c
Created April 29, 2019 08:08
/r/dailyprogrammer #376
#include<stdio.h>
int leaps(int from, int to)
{
int count(0);
for (; from < to; from++) {
if ((from % 100 != 0 || (from % 900 == 200 || from % 900 == 600)) && from % 4 == 0)
count++;
}
@FredrikAugust
FredrikAugust / README.md
Last active September 27, 2018 22:32
Partially functional implementation of A* pathfinding algorithm in Elixir

So, this was a quick attempt at trying to implement the A* pathfinding algorithm in Elixir. Sadly I didn't plan this well enough, and ended up getting stuck in a situation where I would have to rewrite a lot of the structure to make it work properly.

In A* you normally want to keep track of who added to the open list (a parent), so that you don't end up jumping to a random tile that's close just because you've been there before -- you have to be a parent. Sadly, I forgot about this (silly me), and thus this does not work particularly well for mazes etc. (Though it works for this example 🎉)

Will probably rewrite this in the near future, though probably not in Elixir, as I do not believe it is a good fit for this use-case.

@FredrikAugust
FredrikAugust / isbn-check-digit-golf.js
Created July 23, 2018 13:53
Golfed validator of check digit in ISBN (67 characters)
v=i=>(!(eval(i.split('').map((e,i)=>(e*[1,3][i%2])).join('+'))%10))