Skip to content

Instantly share code, notes, and snippets.

View r2r-dev's full-sized avatar
👁️
spiral out

r2r-dev

👁️
spiral out
View GitHub Profile
{ pkgs, lib }: let
system = import <nixpkgs/nixos/lib/eval-config.nix> {
modules = [{
imports = [
<nixpkgs/nixos/modules/installer/cd-dvd/installation-cd-base.nix>
];
boot.initrd.network.enable = true;
boot.devSize = "500m";
boot.initrd.kernelModules = [ "e1000" ];
boot.initrd.extraUtilsCommands =''
@r2r-dev
r2r-dev / gist:553b04bdd93ab4956ab5a2e88d7d6cb9
Last active November 5, 2019 09:19
advanced_rules_k8s
rules_k8s+variables+jsonnet
https://github.com/borg286/better_minig/blob/7a56c859eda2f6a7213c850d6090d7d12b9b569f/go/examples/routeguide/server/BUILD.bazel
nix hydra on k8s
https://github.com/njkli/charts
complex deployments + aspects
https://github.com/dbentley/cnrm-gcpnext19-demo/tree/dbentley/tiltfile_maybe
sonarqube bazel instrumentation

Keybase proof

I hereby claim:

  • I am r2r-dev on github.
  • I am r2r_dev (https://keybase.io/r2r_dev) on keybase.
  • I have a public key ASB0umpHcykU7yGOqEQX59Izy7q7yDBWLEB0_Fgi39iauwo

To claim this, I am signing this object:

@r2r-dev
r2r-dev / bigquery
Last active May 12, 2022 22:12
query github api for metadata and project structure for given list of repositories. output results as csv, remove repository copies and preview results using fzf
SELECT
files.repo_name
FROM (
SELECT
DISTINCT path,
repo_name,
id
FROM
`bigquery-public-data.github_repos.files`
WHERE
@r2r-dev
r2r-dev / bash-anywhere.sh
Last active March 18, 2022 07:19
Bring your own shell together with your script. Stop giving a damn about {zsh, ksh, csh, ash, dash, fish} compatibility and focus on the actual work.
#!/bin/sh -
if [ "$1" != "--wrapped" ]; then
echo "[uw] start"
WD="$(mktemp -d)"
echo "[uw] download deps"
curl -L -s https://github.com/robxu9/bash-static/releases/download/5.1.016-1.2.2/bash-linux-x86_64 \
-o "${WD}/bsh" && chmod +x "${WD}/bsh"
curl -L -s http://landley.net/toybox/downloads/binaries/0.8.6/toybox-x86_64 \
@r2r-dev
r2r-dev / HOWTO.md
Last active April 5, 2022 16:07
quick and dirty lazy /nix/store

Create a lazy /nix/store filesystem using nixfs.py

  1. Grab static nix from https://hydra.nixos.org/build/170454219/download/1/nix and place in the same dir as py script
  2. Install fusepy (on nix: nix-shell -p python3Packages.fusepy)
  3. Ensure your /etc/fuse.conf contains user_allow_other
  4. Create workdirs: mkdir -p $(pwd)/{fakenix,workdir} && mkdir -p $(pwd)/fakenix/nix/store
  5. Mount our fs: python nixfs.py $(pwd)/fakenix $(pwd)/workdir
  6. Run some container image with workdir mounted: docker run -v $(pwd)/workdir/nix:/nix ubuntu:latest
  7. Try running some command, for example: /nix/store/pqpa3glx3iqd0cavslmr0lfkzgq1iias-cowsay-3.03+dfsg2/bin/cowsay thefuck?

# syntax=docker/dockerfile:1
FROM docker.nix-community.org/nixpkgs/cachix@sha256:40fb25ae3467c9b559d35fabf4207d6c93c9ca5157513ea570cb540dae3e58d3 AS builder
WORKDIR /app
COPY jupyter_nix/nix.conf /etc/nix.conf
COPY jupyter_nix/ ./
RUN nix-build default.nix --option sandbox false
RUN mkdir /tmp/nix-store-closure
RUN echo "Output references (Runtime dependencies):" $(nix-store -qR result/)
RUN cp -R $(nix-store -qR result/) /tmp/nix-store-closure
FROM debian/snapshot:stable-20220125
@r2r-dev
r2r-dev / test.sh
Created August 29, 2023 17:45
bazel libdeps test
#!/usr/bin/env bash
function test_cpp_libdeps_fail() {
echo ">>> THIS WILL FAIL"
rm -fr pkg WORKSPACE
mkdir -p pkg
cat <<'EOF' >pkg/BUILD
cc_library(
name = "a.so",
srcs = ["a.cc"],
@r2r-dev
r2r-dev / ***** ***.sh
Created October 16, 2023 13:25
***** ***
watch -n 30 "node curl.js https://wybory.gov.pl/sejmsenat2023/pl/sejm/wynik/pl > r ; cat r | htmlq '.alert' --text | sed 's/&nbsp;/ /g'; cat r | htmlq 'div.val' --text | uniq; rm r"
@r2r-dev
r2r-dev / dquery.sh
Created February 19, 2024 21:09
Bazel graph in terminal
git clone https://github.com/ArthurSonzogni/Diagon.git
nix-shell -p cmake -p pkgconfig -p libuuid -p boost
mkdir build
cmake Diagon -B build
cd build
make
exit
cp diagon /home/user/my-bzl-repo
cd /home/user/my-bzl-repo
nix-shell -p bazel_4 -p fzf