Skip to content

Instantly share code, notes, and snippets.

@davidmroth
davidmroth / cronjob.yaml
Last active June 9, 2024 02:47
Remove Failed Pods
apiVersion: v1
kind: ServiceAccount
metadata:
name: pod-deleter-sa
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
@davidmroth
davidmroth / grafana-ingress.yaml
Created June 6, 2024 17:05
Hosting grafana using ingress-nginx behind a sub path
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$1
nginx.ingress.kubernetes.io/use-regex: "true"
name: grafana
namespace: monitoring
spec:
ingressClassName: nginx
@davidmroth
davidmroth / Share Docker Desktop via Port 2375
Created June 2, 2024 08:56
Share Docker Desktop via Port 2375
docker run --name=docker-share --volume=/var/run/docker.sock:/var/run/docker.sock -p 2375:2375 -d alpine/socat tcp-listen:2375,fork,reuseaddr unix-connect:/var/run/docker.sock
@davidmroth
davidmroth / notes.txt
Created May 14, 2024 15:57
Dockerfile Conditional ARGS
FROM node:latest
ARG YARN_OFFLINE
WORKDIR /app
# Install app dependencies
COPY package.json ./package.json
RUN yarn ${YARN_OFFLINE:+--offline}
@davidmroth
davidmroth / dump.txt
Created May 1, 2024 03:35
Drone Config
# status
System Uptime: 93 seconds, Voltage: 0 * 0.1V (3S battery - OK), System load: 0.03
CPU Clock=72MHz, GYRO=MPU6050, ACC=MPU6050.n, MAG=AK8975
Cycle Time: 997, I2C Errors: 0, config size: 2064
# dump
# version
# Cleanflight/SPARKY 1.12.0 Feb 19 2016 / 20:01:50 (aa8608a)
# dump master
@davidmroth
davidmroth / docker_compose_alias_with_completion.sh
Last active April 7, 2024 05:00
Enabling `docker compose` alias, i.e., dc vs. docker compose
# Add to your .bashrc
# https://www.gnu.org/software/gnuastro/manual/html_node/Bash-TAB-completion-tutorial.html
if which docker >/dev/null 2>&1; then
__docker_compose_cmdline_completion() {
local commands cur prev words cword
COMPREPLY=()
_get_comp_words_by_ref -n : cur prev words cword
@davidmroth
davidmroth / docker.bash
Created April 6, 2024 01:21
Docker ENV
export DOCKER_DEFAULT_PLATFORM=linux/amd64
export DOCKER_HOST="tcp://"$(ifconfig enp0s1 | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | head -1 | awk -F"." '{print $1"."$2"."$3".1"}')":2375"
@davidmroth
davidmroth / Conversation Settings
Last active June 15, 2024 16:10
Custom GPTs OAuth Settings and API for Google Sheets
Converstations Starter: Create a new project: Type: Project, Assignee: John, Category: Job
Instructions (appended to your exsting instructions): When a project data is provided, please update Google Sheets ID: `<sheet id>` using `sheets.spreadsheets.values.append` api call with the information provided and starting at range: `Sheet1!A2`, and continue adding rows as needed.
NOTE: How to find the Google Sheet ID - https://stackoverflow.com/questions/36061433/how-do-i-locate-a-google-spreadsheet-id
@davidmroth
davidmroth / curl-websocket.sh
Created February 10, 2024 05:06 — forked from htp/curl-websocket.sh
Test a WebSocket using curl.
curl --include \
--no-buffer \
--header "Connection: Upgrade" \
--header "Upgrade: websocket" \
--header "Host: example.com:80" \
--header "Origin: http://example.com:80" \
--header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
--header "Sec-WebSocket-Version: 13" \
http://example.com:80/
@davidmroth
davidmroth / Fixing Hung SSH Session
Created February 4, 2024 00:56
Fixing Hung SSH Session
https://serverfault.com/a/283130/486852