Skip to content

Instantly share code, notes, and snippets.

View mcfearsome's full-sized avatar
💭
hacking the mainframe

mcfearsome mcfearsome

💭
hacking the mainframe
View GitHub Profile
local claims = std.extVar('claims');
{
identity: {
traits: {
email: claims.email
}
}
}
@mcfearsome
mcfearsome / find-leftovers.bash
Created June 4, 2022 21:02
k8s-find-resources-in-ns.bash
#!/usr/bin/env bash
ns=default
(k api-resources --namespaced --no-headers | awk '{ print $1 }' -) | (
while read -r LINE; do
echo "resources is: $LINE";
kubectl --namespace=$ns get "$LINE" -owide
done;
)
@mcfearsome
mcfearsome / certificates.sh
Last active April 12, 2022 11:40
quickstart-customizations
apiVersion: batch/v1
kind: Job
metadata:
name: certificate-vault-sg-07dc26eb8f2031520-1
namespace: vault-server
annotations:
cfn-client-token: dcd3b6e6-5814-9767-5f03-6fa6ad673274
spec:
@mcfearsome
mcfearsome / read_github_json.py
Created March 26, 2022 05:44 — forked from porthunt/read_github_json.py
Read json file from a private GitHub repository
import base64
import json
import requests
REPO_URL = "https://api.github.com/repos/<USER>/<REPO>/contents/<PATH>/<TO>/<FILE>.json"
TOKEN = "<YOUR PAT OR OAUTH TOKEN>"
headers = {
"Authorization": f"token {TOKEN}",
"Accept": "application/vnd.github.v4+raw"
# Created by https://www.gitignore.io/api/osx,node,linux,windows
# --------------------------------------------------
# Linux
# --------------------------------------------------
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
@mcfearsome
mcfearsome / add_two.go
Created July 23, 2020 20:41
Things got out of hand messing with a simple Leet Code problem
type ListNode struct {
Val int
Next *ListNode
}
func addTwoNumbers(l1 *ListNode, l2 *ListNode) *ListNode {
pc := make(chan int, 4)
var (
@mcfearsome
mcfearsome / output.sh
Created April 10, 2020 19:14
terraform operator debug output
{"level":"error","ts":1586544983.4896472,"logger":"terraform-k8s","msg":"Could not run new Terraform configuration","error":"Invalid Attribute\n\ninvalid run parameters","stacktrace":"github.com/go-logr/zapr.(*zapLogger).Error\n\t/home/runner/go/pkg/mod/github.com/go-logr/[email protected]/zapr.go:128\ngithub.com/hashicorp/terraform-k8s/operator/pkg/controller/workspace.(*ReconcileWorkspace).Reconcile\n\t/home/runner/work/terraform-k8s/terraform-k8s/operator/pkg/controller/workspace/workspace_controller.go:242\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler\n\t/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:256\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem\n\t/home/runner/go/pkg/mod/sigs.k8s.io/[email protected]/pkg/internal/controller/controller.go:232\nsigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker\n\t/home/runner/go/pkg/mod/sigs.k8s.io/control
@mcfearsome
mcfearsome / callPrint.js
Created July 14, 2019 14:13
Electron launch and print a hidden webview
import { ipcRenderer } from 'electron'
ipcRenderer.send('print', { device: 'printer name', width: 210 })
threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }.to_i
threads threads_count, threads_count
port ENV.fetch('PORT') { 3000 }
env = ENV.fetch('RAILS_ENV') { 'development' }
environment env
plugin :tmp_restart
unless env == 'test' || env == 'development'
#!/usr/bin/env ruby
#
# Cleanup Sidekiq uniquejobs in Redis
# see https://github.com/mhenrixon/sidekiq-unique-jobs/issues/195
#
require 'bundler/setup'
require 'sidekiq/api'
DRY_RUN = true