Skip to content

Instantly share code, notes, and snippets.

View bkleinen's full-sized avatar

Barne Kleinen bkleinen

View GitHub Profile
@bkleinen
bkleinen / twice-linear.md
Created March 13, 2025 22:18
Notes on Twice Linear Solution

Notes on Twice Linear Solution

Kata: https://www.codewars.com/kata/5672682212c8ecf83e000050

  1. sortedSetOf verwendet die java TreeSet-Implemation von SortedSet

  2. diese garantiert, basierend auf einem red-black tree, add() und remove() operations mit O(log n)

  3. d.h. abgesehen von red-black tree statt binary min heap ist das genau der algorithmus mit der Datenstruktur für die unbearbeiten Zahlen die ich vorgeschlagen habe (mit der weiteren optimierung dass sich nicht alle zahlen im array, sondern nur die letzte gemerkt wird)

@bkleinen
bkleinen / gilded_rose.py
Created January 23, 2025 09:33
Gilded Rose Solution for Trial Exam
def get_updater_for(item):
return UPDATERS.get(item.name, UPDATERS["----default-----"])().update
UPDATERS = {
DEFAULT_KEY: NormalItem,
"Aged Brie": AgedBrie,
"Backstage passes to a TAFKAL80ETC concert":
BackstagePass,
"Sulfuras, Hand of Ragnaros": Sulfuras
@bkleinen
bkleinen / merge.md
Created July 15, 2024 21:47
Git Cheat Sheet

git merge --squash

@bkleinen
bkleinen / hugo-modules.md
Last active July 31, 2023 08:42
Hugo Modules Cheatsheet

Use Hugo Modules / Divide Hugo Page into modules

To divide a hugo page into modules resp. move a part of it into a module, three steps are needed:

  1. make site a module
  2. make part a module
  3. import part via site config.toml

for 1. + 2. : to convert anything into a go module, a go.mod file needs to be created with:

classDiagram

    AgingItem <|-- NormalItem
    AgingItem <|-- AgedBrie
    AgingItem <|-- BackstagePass
    
    class AgingItem{
 update(item)
@bkleinen
bkleinen / fragen.md
Last active April 29, 2017 08:17
Starting IMI-Maps with vagrant

http://imimaps-staging.dev-sector.net http://imimaps-production.dev-sector.net

in ci-cd/docker-deploy.rb steht das zentrale deployment-cmd das von travis ausgeführt wird:

      deploy_command = "scp -i id_rsa_#{environment} -o StrictHostKeyChecking=no docker-compose-#{environment}.yml docker-deploy@imimaps-#{environment}.dev-sector.net:~  && \
        ssh  -i id_rsa_#{environment} -o StrictHostKeyChecking=no docker-deploy@imimaps-#{environment}.dev-sector.net \"export TAG=#{tag}; docker-compose -f ~/docker-compose-#{environment}.yml\" up -d"
        system(deploy_command)
@bkleinen
bkleinen / gist:34297b7ee4317bd2b36b
Created December 29, 2015 23:19 — forked from anikalindtner/gist:9524950
Workshops/Mailinglists/Lists
@bkleinen
bkleinen / simple-git-branching-model.md
Last active December 9, 2015 15:27 — forked from jbenet/simple-git-branching-model.md
a simple git branching model

a simple git branching model

(This article is by Juan Bennet, https://gist.github.com/jbenet/ee6c9ac48068889b0912 ) - I just forked it to make sure it doesn't disappear for some reason.)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant

@bkleinen
bkleinen / tn
Last active August 29, 2015 14:08
LSF Participant Extraction
#!/usr/bin/env ruby
# this scripts collects participant data from the "special info" list
# - mainly, it eliminates doublettes (students who have been rejected and applied again)
# and keeps only the most successful application
inputfile = ARGV[0]
outputfile = ARGV[1]
unless inputfile # && outputfile
puts "usage: tn.rb inputfile [outputfile]"
exit 1