Skip to content

Instantly share code, notes, and snippets.

@mowings
mowings / postgres_users.sql
Created December 19, 2022 19:18
Create new read-only postgres user
-- Create a group
CREATE ROLE readaccess;
-- Grant desired access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
@mowings
mowings / README.md
Created November 17, 2022 19:12
Multi-arch builds with docker descktop and buildx

Create a builder

docker buildx create --use

Build and push

docker buildx build --platform linux/arm64/v8,linux/amd64 . -t foo:latest --push
@mowings
mowings / README.md
Created September 15, 2022 20:33 — forked from magnetikonline/README.md
List all Git repository objects by size.

List all Git repository objects by size

Summary

Bash script to:

  • Iterate all commits made within a Git repository.
@mowings
mowings / gist:df16235258271deb0c1ada80091c2b87
Created August 31, 2022 17:30
bash function for getting pod logs by prefix (single pod)
# kube get pod logs by pod name
function podlogs() {
k logs -f $(k get pods | grep "$1" | cut -d ' ' -f 1)
}
@mowings
mowings / readme.txt
Created December 22, 2021 14:45
Update a k8s docker image in a deployment, daemonset etc
kubectl set image deployment/my-deployment app=myimage
@mowings
mowings / registry.md
Last active December 14, 2021 18:10
List docker registry image base names and tags

List base image names and tags

curl https://docker.example.com/v2/_catalog.           # List repos (base image names)
curl https://docker.example.com/v2/myimage/tags/list   # List image tags

Ok for image names to have forward slashes

To get all images in a registry, call the catalog API, then call tags/list for each result.

@mowings
mowings / cell_metrics.txt
Last active October 4, 2021 14:41
Cell Signal Strength Metrics (RSRP. RSRQ, SINR, RSSI)
Source: https://wiki.teltonika-networks.com/view/Mobile_Signal_Strength_Recommendations
RSRP
RSRP Signal strength Description
>= -80 dBm Excellent Strong signal with maximum data speeds
-80 dBm to -90 dBm Good Strong signal with good data speeds
-90 dBm to -100 dBm Fair to poor Reliable data speeds may be attained, but marginal data with drop-outs is possible. When this value gets close to -100, performance will drop drastically
<= -100 dBm No signal Disconnection
RSRQ
@mowings
mowings / kubectl.txt
Created September 15, 2021 22:03
kubectl cp example
kubectl cp production/my-pod-77d5978bbd-hlmzb:/app/output.csv output.csv
@mowings
mowings / readme.md
Last active August 14, 2021 14:52
Postgresql Queues

Use UPDATE SKIP LOCKED to manage queue concurrency

DELETE FROM queue
WHERE itemid = (
  SELECT itemid
  FROM queue
  ORDER BY itemid
  FOR UPDATE SKIP LOCKED
 LIMIT 1