Skip to content

Instantly share code, notes, and snippets.

View so-jelly's full-sized avatar
🍑
Peachy

Shawn O'Dell so-jelly

🍑
Peachy
  • @Wärtsilä
  • Milwaukee, WI
View GitHub Profile
@so-jelly
so-jelly / dag.go
Created August 21, 2023 13:32
dag, hypergraph.. whatver
package main
import (
"errors"
"fmt"
)
// Node represents a node in the DAG.
type Node struct {
ID int
@so-jelly
so-jelly / ftp_client.go
Created July 20, 2023 15:49
ftp client
package main
import (
"context"
"fmt"
"io"
"log"
"path/filepath"
"sync"
@so-jelly
so-jelly / pod.yaml
Created April 13, 2023 14:18
es-zone
apiVersion: v1
kind: Pod
metadata:
name: myapp
labels:
name: myapp
spec:
containers:
- name: myapp
image: &elasticsearch_image docker.io/bitnami/elasticsearch:8.3.3-debian-11-r5
BUCKET=foo-bucket
USER=name@domain.com
gsutil iam get gs://$BUCKET |
jq -r '.bindings |
map(select(any(
.members[]; contains("user:'$USER'")))
|.role)[]'
@so-jelly
so-jelly / gcp project validate
Last active February 9, 2023 17:35
terraform
variable "project_id" {
description = "The name of the Google Project ID where the keys will be stored. eg: 'my-project'"
type = string
}
data "google_projects" "prj" {
filter = "id:${var.project_id}"
lifecycle {
postcondition {
condition = length(self.projects) == 1
@so-jelly
so-jelly / gcloud_connect
Created November 22, 2022 22:30
cloud vm
#!/bin/bash
set -eEo pipefail
set -x
print_usage() {
cat <<HELP_USAGE
Usage:
$0 [-p <project>] [-z <zone>] <vm_name>
-p Project the VM belongs to
@so-jelly
so-jelly / branchclean
Created March 27, 2022 17:14
public shell functions
branchclean () {
for branch in $(git branch | grep -v master)
do
git branch -d $branch
done
}
@so-jelly
so-jelly / advance_letter.go
Created May 21, 2020 22:48
go lang go lan
func advanceLetter(s string, n int) string {
var x []rune
// add a known rune to the slice in case we need to advance it
x = append(x, rune(1337))
// Create a slice of runes
for _, r := range s {
x = append(x, r)
}
// Need to reverse index
@so-jelly
so-jelly / WhoLoggedIn
Created August 7, 2019 23:03
stackdriver
resource.type="k8s_cluster"
protoPayload.methodName="io.k8s.core.v1.pods.exec.create"
@so-jelly
so-jelly / .apt-getrc
Last active July 19, 2019 15:16
aptitude
alias apt-get='apt-get \
-o Acquire::BrokenProxy="true" \
-o Acquire::http::No-Cache="true" \
-o Acquire::http::Pipeline-Depth="0" \
-o Acquire::CompressionTypes::Order::="gz"'