Skip to content

Instantly share code, notes, and snippets.

@0xperp
0xperp / random.md
Created April 1, 2023 20:56
Random Kubernetes Things

Random Kubernetes Things

Creating and Accessing a Secret

# create a secret kubectl create secret generic <name> --from-literal=<key>=<vaule>

# access in a k8s file 
---
containers:
 - env:
@0xperp
0xperp / permissions.md
Created March 22, 2023 02:02
Adding Roles for Kubernetes Waypoint Runner

Using Hashicorp Waypoint runner for Kubernetes is pretty straight forward... but sometimes runs into permissions errors.

Specifically jobs.batch is forbidden: User "system:serviceaccount:waypoint:waypoint-runner" cannot create resource "jobs" in API

You need to

  • create a role with access to the jobs.batch api
  • bind it to the service account

You can do this as follows

@0xperp
0xperp / mach-nix_shell.nix
Last active August 29, 2022 01:37
mach-nix shell base
let
mach-nix = import (builtins.fetchGit {
url = "https://github.com/DavHau/mach-nix";
ref = "refs/tags/3.4.0";
}) {
python = "python39";
pypiData = builtins.fetchTarball "https://github.com/DavHau/pypi-deps-db/tarball/master";
# August 28 2022 Commit
# pypiDataRev = "65195091a39d5ea4d9843923ed1a14a6fd280036";
# pypiDataSha256 = "1wh0ql0m7g7ivyh188c9blvmvz5qd6448b7hilzqlb7y3z6b8mja";
@0xperp
0xperp / python_nix.md
Created August 28, 2022 17:14
Generating and Running Python Scripts in Nix

Generate code for configuration.nix with packages that you need installed

Using nix-template for ease of use

nix-shell -p nix-template

# add any package you want with the `-u` flag
nix-template python -u https://pypi.org/project/libagent/ --stdout
@0xperp
0xperp / nixos_rust_build.sh
Created August 25, 2022 01:30
building a rust binary in nix for production
# should include all of the packages that you need and produce a binary
nix-shell -p cargo libiconv openssl pkgconfig --run "cargo build --release"
@0xperp
0xperp / greek_concentrated_lp_shares.ipynb
Last active July 20, 2023 18:04
greek_concentrated_lp_shares.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@0xperp
0xperp / squeeth_option_hedge.py
Created January 6, 2022 23:49
squeeth_option_hedge.py
###
# Hedging options with squeeth (eth^2) and perps
# https://medium.com/opyn/how-to-hedge-options-with-squeeth-b5e30d5d83ac
# https://docs.google.com/spreadsheets/d/1PBwyqmZXGRZoAlgSa9_ZZiUM28J92-vm7mUybH9HsBc/edit#gid=0
#
# Steps:
# 1. Sell oSQTH with the same gamma as the option that was bought
# 2. Buy ETH futures to hedge the delta from the option that was bought and oSQTH that you sold
###
@0xperp
0xperp / .vimrc
Created January 6, 2022 22:48
.vimrc configuration
syntax on
syntax enable
filetype plugin indent on
set noerrorbells
set tabstop=2
set softtabstop=2
set expandtab
set shiftwidth=2
set smartindent
set nowrap