Skip to content

Instantly share code, notes, and snippets.

View clux's full-sized avatar
🌴
On vacation

Eirik A clux

🌴
On vacation
View GitHub Profile
@clux
clux / pod_api.rs
Created April 13, 2023 21:21
pod_api
use k8s_openapi::api::core::v1::Pod;
use serde_json::json;
use tracing::*;
use kube::{
api::{Api, DeleteParams, ListParams, Patch, PatchParams, PostParams, ResourceExt},
runtime::wait::{await_condition, conditions::is_pod_running},
Client,
};
@clux
clux / logos.txt
Last active January 31, 2022 11:40
logo tests
me goofing around in inkscape
@clux
clux / ky.sh
Last active October 14, 2022 17:26
kubectl get yaml without managedFields
# kubectl < 1.21
ky() {
local -r resource="${1:-$(kubectl api-resources --no-headers | choose 0 | fzf)}"
local -r name="${2:-$(kubectl get ${resource} --no-headers | choose 0 | fzf)}"
kubectl get "${resource}" "${name}" -oyaml \
| yq 'del(.metadata.managedFields)' -y \
| bat -l=yaml --plain --theme=DarkNeon
}
# kubectl >= 1.21
@clux
clux / cla.md
Last active August 2, 2021 14:16
Kube CLA

Contributor License Agreement

Thank you for your interest in the kube-rs project ("Kube") by Eirik 'clux' Albrigtsen (the "Owner"). In order to clarify the intellectual property license granted with Contributions from any person or entity, the Owner must have a Contributor License Agreement ("CLA") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of Kube, the Owner and its users; it does not change your rights to use your own Contributions for any other purpose.

You accept and agree to the following terms and conditions for Your present and future Contributions submitted to the Owner. In return, the Owner shall not use Your Contributions in a way that is contrary to the public benefit. Except for the license granted herein to the Owner and recipients of software distributed by the Owner, You reserve all right, title, and interest in and to Your Contributions.

1. Definitions.

@clux
clux / kapply-heredoc.sh
Last active April 1, 2020 07:34
k-update-cm-filebeat
cat <<EOF | yq . -y | kubectl apply -n kube-system -f -
apiVersion: v1
kind: ConfigMap
metadata: { name: filebeat-config }
data:
filebeat.yml: |-
$(kubectl get cm -n kube-system filebeat-config -oyaml \
| yq '.data["filebeat.yml"]' -r \
| sed -n "/output/q;p" \
| sed -e "\$aoutput.console:\n pretty: false"

Keybase proof

I hereby claim:

  • I am clux on github.
  • I am clux (https://keybase.io/clux) on keybase.
  • I have a public key ASAy9nUjl9_rP6YrGWmB7UYnCUzYrrIhnTHeaokQz_wJ8Qo

To claim this, I am signing this object:

@clux
clux / .gitignore
Last active September 26, 2017 17:05
entrerprise fizzbuzz api
target
@clux
clux / indicatif-hyper.rs
Last active January 12, 2021 05:38
indicatif progress bars with hyper 0.10
pub fn http_download_to_path(url: &str, save: &PathBuf) -> Result<()> {
let client = Client::with_connector(HttpsConnector::new(NativeTlsClient::new().unwrap()));
let mut res = client.get(url).send()?;
if res.status != hyper::Ok {
return Err(Error::SomeError)));
}
let use_progress = true;
if use_progress {
use indicatif::{ProgressBar, ProgressStyle};
@clux
clux / prompt.sh
Last active February 2, 2022 21:20
git-prompt-powerline-style
#!/bin/bash
export TERM=xterm-256color
show_cwd() {
local dir_limit="3"
local truncation="⋯"
local first_char
local part_count=0
local formatted_cwd=""
local dir_sep="  "
#!/usr/bin/env node
/**
* Small program to figure solve the challenge and response based polynomial problem:
* Adversary generates p(x) = a_0 + a_1*x + a_2*x^2 + ... + a_n*x^n
* where a_i are non-negative integers.
*
* This program will compute all the a_i given only two inputs (challenges)
* - p1 = p(1) (equal to the sum of coefficients by assumption of a_i)
* - pN = p(p(1) + 1)