Skip to content

Instantly share code, notes, and snippets.

View wpcarro's full-sized avatar

William Carroll wpcarro

View GitHub Profile
@wpcarro
wpcarro / supported_kernels.txt
Created October 14, 2022 21:19
allowed kernels for crowdstrike
kernels="2.6.32-431.el6.x86_64
2.6.32-431.1.2.el6.x86_64
2.6.32-431.1.2.0.1.el6.x86_64
2.6.32-431.3.1.el6.x86_64
2.6.32-431.5.1.el6.x86_64
2.6.32-431.11.2.el6.x86_64
2.6.32-431.17.1.el6.x86_64
2.6.32-431.20.3.el6.x86_64
2.6.32-431.20.5.el6.x86_64
2.6.32-431.23.3.el6.x86_64
@wpcarro
wpcarro / vars.txt
Last active November 1, 2022 17:57
Does pkgs.mkShell need to expose all of these?
+buildPhase +builder +cmakeFlags +configureFlags +depsBuildBuild
+depsBuildBuildPropagated +depsBuildTarget +depsBuildTargetPropagated
+depsHostHost +depsHostHostPropagated +depsTargetTarget
+depsTargetTargetPropagated +doCheck +doInstallCheck +mesonFlags +name
+nativeBuildInputs +out +outputs +patches +phases +propagatedBuildInputs
+propagatedNativeBuildInputs +stdenv +strictDeps +system
@wpcarro
wpcarro / example.nix
Created November 1, 2022 20:38
Validate depends_on at eval-time
{ pkgs ? import <nixpkgs> {} }:
let
pipeline = [
{
key = "root";
command = "echo \"I am groot\"";
}
{
depends_on = [ "root" ];
@wpcarro
wpcarro / depends-on.patch
Created November 4, 2022 21:51
Supporting dependsOn for extraSteps API
diff --git a/tvl-kit/buildkite/default.nix b/tvl-kit/buildkite/default.nix
index b04dc55a0..2be217937 100644
--- a/tvl-kit/buildkite/default.nix
+++ b/tvl-kit/buildkite/default.nix
@@ -340,6 +340,7 @@ rec {
, postBuild ? null
, skip ? false
, agents ? null
+ , dependsOn ? [ ]
}:
@wpcarro
wpcarro / httpx_wrapped.py
Created November 9, 2022 18:28
Wrapping httpx to auto-instrument the HTTP client with OTLP support.
import httpx
from opentelemetry.instrumentation.httpx import HTTPXClientInstrumentor
HTTPXClientInstrumentor().instrument()
@wpcarro
wpcarro / toggle-envrc-visibility.sh
Created November 11, 2022 17:42
Toggles the visibility of all .envrc files in a git repository except for the top-level .envrc.
set -euo pipefail
: ${REPO:=/depot}
: ${FLAG:=$REPO/.git/hide-envrcs}
if [ ! -f $FLAG ]; then
git -C $REPO update-index --assume-unchanged $(git -C $REPO ls-files -v | grep -E '^H .+\.envrc$' | awk '{ print $2 }')
git -C $REPO ls-files -v | grep -E '^h .+\.envrc$' | awk '{ print $2 }' | xargs rm
touch $FLAG
else
@wpcarro
wpcarro / test.nix
Created November 17, 2022 21:41
overrideAttrs question
[
{
# builds
bcrypt = super.bcrypt.overrideAttrs (old: {
cargoDeps = pkgs.rustPlatform.fetchCargoTarball {
name = "${old.pname}-${old.version}";
src = old.src;
sourceRoot = "${old.pname}-${old.version}/src/_bcrypt";
sha256 = "19j1hcwr6c7r3p9b3af5dfa9m5jimxk0cwmspd692d84svmrfdcl";
};
@wpcarro
wpcarro / macro.el
Created November 25, 2022 05:43
Random Elisp macro for composing functions.
(defmacro >-> (&rest forms)
"Compose a new, point-free function by composing FORMS together."
(let ((sym (gensym)))
`(lambda (,sym)
(->> ,sym ,@forms))))
@wpcarro
wpcarro / immutable_list.py
Created November 28, 2022 23:40
Python immutable list type (generated with OpenAI's text-davinci-003 model)
"""
1. Define an immutable list type.
2. Create a library for manipulating the list.
"""
# Answer
# 1. Define an immutable list type
class ImmutableList:
@wpcarro
wpcarro / py_to_nix.py
Created November 28, 2022 23:42
Convert Python data types to Nix data types (generated by OpenAI's text-davinci-003 model)
"""
1. Write a library that transforms python data types into Nix data types.
"""
# This library would need to convert python data types such as integers, strings, booleans, lists, dictionaries, and tuples into the Nix data types of strings, booleans, lists, sets, and recursive values. The library should use functions to convert each type of data.
# For example, a function to convert a python integer to a Nix string would look like this:
def int_to_nix_string(x):
return f'"{x}"'