Skip to content

Instantly share code, notes, and snippets.

View nightscape's full-sized avatar

Martin Mauch nightscape

  • Regensburg, Germany
  • 04:16 (UTC +02:00)
View GitHub Profile
@StephenSorriaux
StephenSorriaux / install-kubernetes-archlinux.md
Created October 25, 2018 18:47
Install Kubernetes on bare-metal ArchLinux host

Installing Kubernetes on ArchLinux

Packages

pacman -S curl docker ebtables ethtool wget unzip

Also cfssl is needed but available on AUR, using pacaur

pacaur -S cfssl

Kakmacs

Introduction

Setup

Dependencies

These aren’t all dependencies, but only the ones which isn’t loaded by my usual init-file.

@gvolpe
gvolpe / di-in-fp.md
Last active September 16, 2024 07:18
Dependency Injection in Functional Programming

Dependency Injection in Functional Programming

There exist several DI frameworks / libraries in the Scala ecosystem. But the more functional code you write the more you'll realize there's no need to use any of them.

A few of the most claimed benefits are the following:

  • Dependency Injection.
  • Life cycle management.
  • Dependency graph rewriting.
class ParentType(val id: Long)
class ChildType
class ChildTypeBatchApi {
fun load(keys: List<Long>): List<ChildType> = mutableListOf()
}
val childTypeBatchApi = ChildTypeBatchApi()
// Example BatchLoader
var batchLoader: BatchLoader<Long, ChildType> = BatchLoader { keys ->
@mandubian
mandubian / diff-viz.scala
Created October 16, 2017 13:22
Visualizing scala code diff in scala code (result is compiling Scala code with diffs annotated in comments)
// Build Scala source code
val tree = q"""
object Test {
val a = 2 + 5
def f(b: String) = { b + a.toString }
}
"""
val src = List(TreeNode(tree))
// Build Scala target code
@mrdziuban
mrdziuban / scala_repl.rb
Last active March 6, 2018 07:18
Start a Scala REPL with the highest version of each jar in $HOME/.ivy2/cache on the classpath
#!/usr/bin/env ruby
################################################################################
# #
# Starts a Scala REPL with the highest version of each jar in #
# $HOME/.ivy2/cache on the classpath. #
# #
# See below for installation instructions #
# #
################################################################################
@sscotth
sscotth / keystroke the clipboard extended.workflow
Last active April 5, 2025 15:58
Paste as keystrokes (macOS)
# Why?
# To paste text into windows that normally don't allow it or have access to the clipboard.
# Examples: Virtual machines that do not yet have tools installed, websites that hijack paste
#
# Extended vs Simple?
# * Includes an initial delay to allow you to change active windows
# * Adds small delay between keypresses for slower responding windows like SSH sessions
# * Better handling of numbers
# * VMWare bug fix
#
@tinogomes
tinogomes / DNS_TO_LOCALHOST.markdown
Last active March 25, 2025 08:05
Public DNS Pointing to localhost (127.0.0.1)

Available Public Wildcard DNS Domains pointing to localhost (127.0.0.1)

The best way to safely and securely use local domains pointing to 127.0.0.1 is to edit your local settings (/etc/hosts) and add your own settings. Keep in mind if you want to use subdomains, you need to enter all variations.

Example:

# Adding bottom of your current file /etc/hosts
################# MY LOCAL DOMAINS
127.0.0.1 local.com admin.local.com
127.0.0.1 domain1.com
sealed trait Decidable[+Proof]
final case class Yes[Proof](proof: Proof) extends Decidable[Proof]
final case object No extends Decidable[Nothing]
sealed trait List[+A] {
def nonEmpty: Decidable[this.type <:< ::[A]]
def ::[AA >: A](value: AA): ::[AA] = new ::[AA](value, this)
}
final case object Nil extends List[Nothing] {
def nonEmpty: Decidable[this.type <:< ::[Nothing]] = No