Skip to content

Instantly share code, notes, and snippets.

View grampelberg's full-sized avatar

Thomas Rampelberg grampelberg

View GitHub Profile
let errors: Vec<kube::Error> = futures::stream::iter(crate::resources::all())
.map(|resource| async move { client.create(&PostParams::default(), &resource).await })
.buffered(100)
.inspect(|result| {
if let Ok(o) = result {
info!(name = o.name_any(), "created CRD");
}
})
.collect::<Vec<Result<CustomResourceDefinition, _>>>()
.await
let mut serializer = serde_yaml::Serializer::new(std::io::stdout());
for resource in resources::all() {
resource.serialize(&mut serializer)?;
}
def my_func(foo, bar):
def construct(fn):
class Object:
pass
Object.foo = foo
Object.bar = bar
return Object
pub fn add(a: i32, b: i32) -> i32 {
a + b
}
// This is a really bad adding function, its purpose is to fail in this
// example.
#[allow(dead_code)]
fn bad_add(a: i32, b: i32) -> i32 {
a - b
}
#[derive(Debug, Clone)]
pub struct Client {
service_url: url::Url,
}
impl Client {
pub fn new(service_url: &str) -> Result<Self, Report> {
let url = url::Url::parse(service_url)?;
Ok(Self { service_url: url })
@grampelberg
grampelberg / com.openssh.ssh-agent-brew.plist
Last active July 27, 2022 22:03
com.openssh.ssh-agent-brew.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.openssh.ssh-agent-brew</string>
<key>ProgramArguments</key>
<array>
#!/usr/bin/env bash
set -o errexit -o nounset -o pipefail
cfg="${HOME}/.oprc"
required_cfg=(
'OP_ADDRESS'
'OP_EMAIL'
'OP_ACCOUNT_KEY'
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
CURRENT_DIR := $(notdir $(patsubst %/,%,$(dir $(MKFILE_PATH))))
include $(CURRENT_DIR)/.env
include $(CURRENT_DIR)/mk/dependency.mk
include$(CURRENT_DIR)/mk/other.mk
main: dependency-one other-two
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c -x
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
CURRENT_DIR := $(notdir $(patsubst %/,%,$(dir $(MKFILE_PATH))))
for ctx in west east; do
echo "Checking cluster: ${ctx} .........\n"
linkerd --context=${ctx} check || break
echo "-------------\n"
done