Skip to content

Instantly share code, notes, and snippets.

View shalomb's full-sized avatar
🎯
Knolling

Shalom Bhooshi shalomb

🎯
Knolling
View GitHub Profile
@shalomb
shalomb / main.tf
Last active September 6, 2021 19:20
Terraform hackery - null_resource/local-exec + external/program data sources
# Demo of the external data source
# https://registry.terraform.io/providers/hashicorp/external/latest/docs/data-sources/data_source
data "external" "passwd_field" {
program = [ "./passwd_field.sh" ]
query = {
user = var.user
field = var.field
file = local.target_file
}
depends_on = [
@shalomb
shalomb / README.md
Last active April 22, 2021 23:15
Signing virtualbox/vmplayer kernel modules

Sign virtualbox/vmplayer drivers on secure boot systems

Usage

$ ./generate-mok-cert.sh
$ sudo reboot  # and follow the MOK enrollment wizard
$ ./virtualbox-fix.sh
@shalomb
shalomb / Makefile
Last active April 19, 2021 21:30
v - A modern rewrite of https://github.com/rupa/v using fzf/bat
install:
chmod +x ./v
install -m550 $$PWD/v ~/.local/bin/
install -m550 $$PWD/v ~/.local/bin/
@shalomb
shalomb / 0-fizzbuzz-simple.go
Last active April 13, 2021 10:32
Learning go the fizzybuzzy way
package main
// [Fizzbuzz: One Simple Interview Question](https://www.youtube.com/watch?v=QPZ0pIK_wsc)
import "fmt"
func fizzbuzz(i int) (text string) {
fizz := i%3 == 0
buzz := i%5 == 0
@shalomb
shalomb / bike-build.md
Last active January 14, 2021 10:23
Kona Dew Deluxe road bike conversion

Bike

Bike: Kona Dew Deluxe 2011
Frame: Kona 7005 Aluminum Butted, 61cm
Size: 61cm (24")
Weight: 10.2kg
Freewheel: Shimano HG30 11-32 9 spd (Hub???)\

@shalomb
shalomb / tf-init.sh
Created October 14, 2020 10:44
terraform initialization
#!/bin/bash
# Initialize terraform so that the ansible-terraform-openstack dynamic
# inventory script can succeed.
bin_dir=${bin_dir:-$( cd "${BASH_SOURCE[0]%/*}" && pwd )}
source "$bin_dir/init.sh" # shared config with ansible, cidb, etc
export TF_VAR_OS_USERNAME="$OS_USERNAME"
export TF_VAR_OS_PASSWORD="$OS_PASSWORD"
@shalomb
shalomb / data.json
Last active September 21, 2020 10:16
OPA Test Run
{
"roles": [
{
"operation": "read",
"resource": "widgets",
"name": "widget-reader"
},
{
"operation": "write",
"resource": "widgets",
@shalomb
shalomb / backup.sh
Last active July 31, 2020 21:02
using rsync to backup data from aws instance
#!/bin/bash
set -eu -o pipefail
set -xv
ssh_args='-i ./aws-jira.pem -o StrictHostKeyChecking=no -o PubkeyAuthentication=yes'
[email protected]
# Stop services so our backups are integral
#!/usr/bin/env python3
import yaml
def get_content(file='clouds.yaml'):
with open(file, 'r') as stream:
return yaml.safe_load(stream)
def set_content(file='clouds.yaml', content=None):
with open(file, 'wt') as stream:
// Solution to exercise at https://tour.golang.org/methods/18
// Exercise: Stringers
// Make the IPAddr type implement fmt.Stringer to print the address as a dotted quad.
// For instance, IPAddr{1, 2, 3, 4} should print as "1.2.3.4".
package main
import (
"fmt"