Skip to content

Instantly share code, notes, and snippets.

@JeffreyVdb
JeffreyVdb / Kube-cron-extract-job.sh
Last active May 17, 2018 12:41
Extract a job from a kubernetes cronjob
function kcrongetjob() {
local cronjob_name="$1"
local namespace="${2:-default}"
local _json
_json=$(kubectl -n $namespace get cronjob $cronjob_name -o json --export 2>&1)
if [ $? -eq 0 ]; then
echo "{
\"apiVersion\": \"batch/v1\",
\"kind\": \"Job\",
@JeffreyVdb
JeffreyVdb / install-kubectl-multiplatform.ps1
Created May 29, 2018 09:23
Install kubectl mutli platform
#!/usr/bin/pwsh
function Get-KubectlUnix {
param (
[string]$Version,
[string]$Platform
)
$tempPath = [System.IO.Path]::GetTempFileName()
$kubectlURL = "https://storage.googleapis.com/kubernetes-release/release/$($Version.Trim("`n"))/bin/$Platform/amd64/kubectl"
#!/usr/bin/env zsh
if (( $+commands[kubectl] )); then
source <(kubectl completion zsh)
fi
function env_to_secret() {
perl -MMIME::Base64 -ne '/^(.*?)=(.*)$/ && printf("$1: %s\n", encode_base64($2, ""))'
}
@JeffreyVdb
JeffreyVdb / github-to-s3.ps1
Created August 6, 2018 11:11
Backup github repositories to AWS S3
#!/usr/bin/pwsh
Param (
[Parameter(Mandatory=$True, Position=1)]
[string]$RepositoryName,
[Parameter(Mandatory=$True)]
[string]$BucketName,
[Parameter(Mandatory=$True)]
[string]$Organization = "",
@JeffreyVdb
JeffreyVdb / keybase.md
Created October 8, 2018 06:38
keybase.md

Keybase proof

I hereby claim:

  • I am JeffreyVdb on github.
  • I am jeffreyvdb (https://keybase.io/jeffreyvdb) on keybase.
  • I have a public key whose fingerprint is 389A 3305 D823 729D 7FF8 A8C0 53D4 B3FF B09B 6422

To claim this, I am signing this object:

#!/bin/bash
set -euo pipefail
mktempfile() {
tmpfile=$(mktemp --tmpdir=/tmp "$1")
echo "Created $tmpfile" >/dev/tty
printf "%s" "$tmpfile"
}
KEY_NAME="${1:-}"
@JeffreyVdb
JeffreyVdb / chown.zig
Last active October 22, 2021 12:28
Change owner of a file / directory using zig
const c = @cImport(@cInclude("unistd.h"));
const std = @import("std");
const ChownData = struct {
uid: c_uint,
gid: c_uint,
filename: [:0]const u8,
};
pub fn main() !void {
@JeffreyVdb
JeffreyVdb / prio-paths.zig
Created November 29, 2021 15:56
Prioritize paths
const std = @import("std");
const HashMap = std.HashMap;
const Allocator = std.mem.Allocator;
const StringHashMap = std.hash_map.StringHashMap;
const SinglyLinkedList = std.SinglyLinkedList;
pub fn main() !void {
var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
defer arena.deinit();
@JeffreyVdb
JeffreyVdb / build-path.py
Last active December 29, 2021 19:45
Build PATH variable via checking if the provided arguments are existing directories
import sys
import os.path
if __name__ == "__main__":
paths = [p for p in sys.argv[1:] if os.path.exists(p) and os.path.isdir(p)]
if not paths:
sys.exit(0)
print(os.path.pathsep.join(paths))
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"basics": {
"name": "Jeffrey Vandenborne",
"label": "Software Engineer - Sysadmin - Tech geek",
"image": "",
"email": "[email protected]",
"phone": "+32483126523",
"url": "https://jeffrey.vandenborne.co",
"summary": "I believe that a good software engineer should be like a chameleon: instantly able to adapt the technologies required for the task at hand. Choosing the right tool for the job is the real complexity.",