Skip to content

Instantly share code, notes, and snippets.

View nightkr's full-sized avatar

Natalie Klestrup Röijezon nightkr

View GitHub Profile
@nightkr
nightkr / 000-readme
Created July 25, 2023 08:23
crd versioning experiments
applies to current main (https://github.com/kube-rs/kube/commit/823f4b8db3852e6bdd271e72c56b8c40d6f962a8)
DROP TABLE IF EXISTS group_role_transactions;
CREATE TABLE group_role_transactions(
tx_time INTEGER PRIMARY KEY,
group_id VARCHAR NOT NULL,
role_id VARCHAR NOT NULL,
action VARCHAR NOT NULL
);
INSERT INTO group_role_transactions(tx_time, group_id, role_id, action) VALUES(1, 'foobar', 'test_role1', 'grant');
INSERT INTO group_role_transactions(tx_time, group_id, role_id, action) VALUES(2, 'foobar', 'test_role2', 'grant');
INSERT INTO group_role_transactions(tx_time, group_id, role_id, action) VALUES(3, 'foobar', 'test_role2', 'revoke');
fn api_watch<K: Resource + Clone + DeserializeOwned + Debug + Send + 'static>(
api: Api<K>,
list_params: ListParams,
) -> impl Stream<Item = Result<WatchEvent<K>>> {
watcher(api, list_params).flat_map(|ev| match ev {
Ok(Event::Applied(o)) => stream::once(future::ready(Ok(WatchEvent::Added(o)))).left_stream(),
Ok(Event::Restarted(os)) => {
stream::iter(os.into_iter().map(WatchEvent::Added).map(Ok)).right_stream()
}
Ok(Event::Deleted(o)) => stream::once(future::ready(Ok(WatchEvent::Deleted(o)))).left_stream(),
{fetchFromGitHub, fetchurl, runCommand, python35Packages, linuxHeaders, libusb1}:
let
inherit (python35Packages) buildPythonApplication buildPythonPackage;
pyLibusb1 = buildPythonPackage rec {
name = "libusb1-1.5.3";
src = fetchurl {
url = "mirror://pypi/l/libusb1/${name}.tar.gz";
sha256 = "1sj9jvibsqx1nb3asabwi85z606bx8vhmwk4k3wj357yzkwvpxl5";
};
@nightkr
nightkr / update-screenshots.js
Created September 6, 2016 11:42
PhantomJS screenshot script
var system = require('system');
var url = "http://localhost/"+system.args[1];
var destination = "screenshots/"+system.args[2];
var width = system.args[3] || 900;
console.log("Dumping " + url + " to " + destination);
var page = require('webpage').create();
page.viewportSize = {
width: width,
height: 1

Bye, Keybase.

{ writeScriptBin
, bash
, sudo
, postgresql
, version
, dataDir
, user
}: writeScriptBin "pg_dumpall_${version}"
''
#!${bash}/bin/bash
 teo  ~  nix-build -A 'haskell.packages.ghc7103.integer-simple' --no-out-link '<nixpkgs>'
these derivations will be built:
/nix/store/slh2m6py5shk9yjhfwkyd919r5nnbxgz-integer-simple-0.1.1.1.drv
building path(s) ‘/nix/store/ssiixl8qq2wkgg97135nnhscqi220fyv-integer-simple-0.1.1.1’
setupCompilerEnvironmentPhase
Build with /nix/store/g2pi8g139zj3vja22g4bq8krn0z3lb10-ghc-7.10.3.
unpacking sources
unpacking source archive /nix/store/nfv1gbj3yad9jiwjs06d6q8ahx25lgbp-integer-simple-0.1.1.1.tar.gz
source root is integer-simple-0.1.1.1
setting SOURCE_DATE_EPOCH to timestamp 1463836297 of file integer-simple-0.1.1.1/Setup.hs
NullVector[n] := Array[0 &, n]
Kernel[M_] := Block[{
rows = Dimensions[M][[1]],
cols = Dimensions[M][[2]]
}, Module[{
C = Array[c, cols],
nullv = NullVector[rows]
}, (C /. Solve[M.C == nullv])[[1]]
]]
VectorSpan[v_] := (v /. # -> 1) & /@ Variables[v]
trait A {
def get: Seq[String]
}
trait B { this: A =>
override def get: Seq[String] = Seq()
}
trait C extends B {
override def get = super.get :+ "C"