Skip to content

Instantly share code, notes, and snippets.

View tlipinski's full-sized avatar

Tomasz Lipinski tlipinski

  • Krakow, Poland
  • 15:23 (UTC +02:00)
View GitHub Profile
@tlipinski
tlipinski / FixingComposability.scala
Last active September 10, 2021 23:04
Fixing composability
// We've got some very simple function which triples provided argument
def triple(a: Int): Int = 3 * a
// It composes nicely
triple(24) // val res0: Int = 72
triple(triple(24)) // val res1: Int = 216
// ---------------------------------------------------------------------------
// We want to add a check to this function which won't allow
@tlipinski
tlipinski / rules.v4
Created October 10, 2019 20:43
Restricting access to NodePort service in Kubernetes
*nat
:PREROUTING ACCEPT [1:40]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:KUBE-SERVICES - [0:0]
-A PREROUTING -s 1.2.3.0/24 -j KUBE-SERVICES
-A PREROUTING -s 4.5.6.0/24 -j KUBE-SERVICES
-A PREROUTING -j RETURN
-A PREROUTING -m comment --comment "kubernetes service portals" -j KUBE-SERVICES
image: alpine
before_script:
- env | sort
stages:
- testing
- deploying
test:
@tlipinski
tlipinski / trim-check
Created August 3, 2012 22:27
Simple script that checks if SSD drive has TRIM enabled.
path=$1
drive=$2
name=/_tempfile_
file=$path$name
echo Test file: $file
seq 1 1000 > $file
sync; sleep 2