Skip to content

Instantly share code, notes, and snippets.

View nrktkt's full-sized avatar

Nathan Fischer nrktkt

View GitHub Profile
#!/usr/bin/env bash
icon="$HOME/.xlock/icon.png"
tmpbg='/tmp/screen.png'
(( $# )) && { icon=$1; }
scrot "$tmpbg"
convert "$tmpbg" -scale 5% -scale 2000% "$tmpbg"
# convert "$tmpbg" "$icon" -gravity center -composite -matte "$tmpbg"
@nrktkt
nrktkt / oauth2-oidc-grant.md
Last active April 20, 2018 17:06
Example of token grant with OID Connect code flow

note: line breaks added for readablity

The web client (user agent) (client.oursite.com) should direct the user to authenticate through the Open ID Connect authorization code flow. The user agent should at this point have an authorization code from the provider. The below shows exactly how the user agent exchanges that code for an access token from the backend (server.oursite.com).

POST /token HTTP/1.1
Host: server.oursite.com
Content-Type: application/x-www-form-urlencoded

grant_type=x-oidc-code

Java - Scala Dictionary

Variable declaration/initialization

Java

List<String> uninitializedList;
List<String> initializedList = new LinkedList<>;

Scala

var uninitializedList: List[String]
@nrktkt
nrktkt / hosts
Created August 29, 2018 21:03
Ad blocking hosts file
127.0.0.1 ads.yieldmo.com
-- __
~ (@) ~~~---_
{ `-_~,,,,,,)
{ (_ ',
~ . = _',
~ '. =-'
~ :
. -~ ('');
'. --~ \ \ ;
'.-_ -~ \ \; _-=,.
@nrktkt
nrktkt / gear.md
Last active January 5, 2019 23:16
Six pieces of outdoor clothing everyone should own

These staples should last you many years and be usable in almost all your outdoor persuits, from summer hiking to fall backpacking, to snowsports, and even a bit of light summer mountaineering.
Without further ado we'll start from the bottom to the top.

The gear

  1. Wool socks
    Wool stays warm and wicks moisture when wet. As long as you've got breathable shoes wool socks can be comfortable even in the summer. As an added perk they're nice and cheap.
  2. Softshell pants Tough, breathable, and windproof are the trademark characteristics of softshell pants. They're typically not insulated and so are suitable for warm weather, but their wind resistance makes them plenty warm when the mercury drops (especially when worn over a long baselayer).
@nrktkt
nrktkt / README.MD
Created August 12, 2019 18:42
Key based scala rate limiter

Scala key based rate limiter with automatic key eviction.

Depends on Guava and Akka Actors.

@nrktkt
nrktkt / tillerless.md
Last active February 17, 2021 01:12
Using Helm without Tiller

Intro

Assume we have some Helm chart we want to deploy, but we don't want to install Tiller on our Kubernetes cluster. This doc will cover how to deploy a helm chart without installing Tiller on the cluster, but will not go into the motivations or tradeoffs of doing so.

Prereqs

  1. Helm installed locally
  2. Helm initialized (helm init --client-only)
  3. kubectl working for your cluster
@nrktkt
nrktkt / ExampleSpec.scala
Last active February 27, 2020 07:34
AWS unit tests with localstack and scalatest
import cloud.localstack.docker.annotation.LocalstackDockerProperties
import cloud.localstack.TestUtils
import org.scalatest.{BeforeAndAfterEach, FlatSpec}
import ...LocalstackSpec
@LocalstackDockerProperties(services = Array("s3"))
class ExampleSpec
extends FlatSpec
with BeforeAndAfterEach
with LocalStackSpec {