Skip to content

Instantly share code, notes, and snippets.

@veggiemonk
veggiemonk / hash_sha256.go
Created July 3, 2022 12:50
Go Snippets: hashing strings with SHA256 algorithm
package main
import (
"bytes"
"crypto/sha256"
"encoding/hex"
"fmt"
)
// Go Playground https://go.dev/play/p/1EaM_5NQmc5
@veggiemonk
veggiemonk / uuid_numbers.go
Created July 3, 2022 12:23
[experimental] Encode UUID as string of numbers
package main
import (
"fmt"
"math/big"
"strings"
"github.com/google/uuid"
)
@veggiemonk
veggiemonk / download-org-repos.sh
Last active November 16, 2021 13:23
download all repos from github org
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/orgs/flyteorg/repos > repos.json
cat repos.json | jq '.[].git_url' | xargs -I REPO git clone REPO
format = """
$username\
$hostname\
$directory\
$git_branch\
$git_commit\
$git_state\
$git_status\
$docker_context\
$package\
@veggiemonk
veggiemonk / install_wireguard.sh
Created September 17, 2020 21:48
automated Install wireguard script for Ubuntu 20.04
@!/usr/bin/env bash
set -xe
sudo apt update && sudo apt install -y wireguard
export CLIENT_PUBLIC_KEY="[INSERT CLIENT PUB KEY HERE]"
export CLIENT_VPN_IP="10.0.0.2" # change this if necessary, the server vpn ip is 10.0.0.1 as defined in the config
export SERVER_NAME="serverwg"
@veggiemonk
veggiemonk / generate-kubeflow-manifest.sh
Created September 13, 2020 10:15
Generate KubeFlow manifest
#!/usr/bin/env bash
command -v kfctl >/dev/null 2>&1 || { echo; echo >&2"command kfctl is missing"; exit 1; }
command -v wget >/dev/null 2>&1 || { echo; echo >&2"command wget is missing"; exit 1; }
# Set the following kfctl configuration file:
# Other config can be found here: https://www.kubeflow.org/docs/started/getting-started/
export CONFIG_URI="https://raw.githubusercontent.com/kubeflow/manifests/v1.1-branch/kfdef/kfctl_k8s_istio.v1.1.0.yaml"
# Set KF_NAME to the name of your Kubeflow deployment. You also use this
# value as directory name when creating your configuration directory.
@veggiemonk
veggiemonk / .zshrc
Last active December 5, 2021 20:27
zshrc linux
export PATH=$HOME/bin:/usr/local/bin:$PATH
export ZSH="~/.oh-my-zsh"
ZSH_THEME="robbyrussell"
DISABLE_UPDATE_PROMPT="true"
# Uncomment the following line if pasting URLs and other text is messed up.
DISABLE_MAGIC_FUNCTIONS="true"
@veggiemonk
veggiemonk / vimrc
Created September 8, 2020 21:42
vimrc
let $RTP=split(&runtimepath, ',')[0]
let $RC="$HOME/.vim/vimrc"
filetype plugin indent on
syntax on
set shiftwidth=4 tabstop=4 softtabstop=4 expandtab autoindent smartindent
set path=.,**
set backspace=start,eol,indent
set hidden
@veggiemonk
veggiemonk / migrate_reveal.sh
Created April 27, 2020 18:22
small bash scripts to migrate all slides
#!/usr/bin/env bash
rm -rf presentations
mkdir -p presentations
function create_html() {
local HTML='<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Presentations</title></head><body><ul>'
@veggiemonk
veggiemonk / demo-cloud-run.sh
Created April 18, 2020 14:38
kth serverless demo
#!/bin/bash
set -xe
# Meant to be run in cloud shell
# Enable APIs if not already done
# gcloud services enable run.googleapis.com containerregistry.googleapis.com
echo
echo "download container image locally"