Skip to content

Instantly share code, notes, and snippets.

@mindw
mindw / postgres-brew.md
Created February 22, 2022 08:33 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@mindw
mindw / k.sh
Last active March 17, 2022 12:52
kubectl Cookbook
# list pods only with enabled service links.
kgpoall -o jsonpath='{range .items[*]}{"\n"}{.metadata.name}{":\t"}{.spec.enableServiceLinks}' | grep true
# list images used in containers (but not in initContainers!).
kubectl get pods --all-namespaces -o=jsonpath='{range .items[*]}{"\n"}{.metadata.namespace}{"/"}{.metadata.name}{":\t"}{range .spec.containers[*]}{.name}{"="}{.image}{", "}{end}{end}' |sort
# list containers without memory limits
kubectl get pods --all-namespaces -o=jsonpath='{range .items[*]}{"\n"}{.metadata.name}{":\t"}{range .spec.containers[*]}{.resources.limits.memory}{", "}{end}{end}' |sort | grep 0,
# running a pod which immidiately exists - the restart policy is crticial
# display VPC ID, CIDR Block and Name
aws ec2 --output text --query 'Vpcs[*].{VpcId:VpcId,Name:Tags[?Key==`Name`].Value|[0],CidrBlock:CidrBlock}' describe-vpcs
@mindw
mindw / empty_bucket.sh
Created July 30, 2019 13:13 — forked from wknapik/empty_bucket.sh
Empty an s3 bucket of all object versions and delete markers in batches of 1000
#!/usr/bin/env bash
set -eEo pipefail
shopt -s inherit_errexit >/dev/null 2>&1 || true
if [[ ! "$#" -eq 2 || "$1" != --bucket ]]; then
echo -e "USAGE: $(basename "$0") --bucket <bucket>"
exit 2
fi
@mindw
mindw / Jenkinsfile
Created January 30, 2019 15:02 — forked from mikesplain/Jenkinsfile
Jenkins kubernetes dind
podTemplate(label: 'mypod', containers: [
containerTemplate(name: 'docker', image: 'docker:dind', ttyEnabled: true, alwaysPullImage: true, privileged: true,
command: 'dockerd --host=unix:///var/run/docker.sock --host=tcp://0.0.0.0:2375 --storage-driver=overlay')
],
volumes: [emptyDirVolume(memory: false, mountPath: '/var/lib/docker')]) {
node ('mypod') {
stage 'Run a docker thing'
container('docker') {
stage 'Docker thing1'
@mindw
mindw / sybil.py
Last active October 8, 2018 08:24
A poor man's sibbel replacement.
# python 3.6
# github3.py > 1.1.0
# developer token must have the repo & user outh2 scopes!
import github3
from github3 import login
from github3.git import Tag
from urllib.parse import urlparse
from pathlib import Path
import datetime
@mindw
mindw / calico.json
Last active April 20, 2018 11:43 — forked from zihaoyu/calico.json
Calico (Canal) grafana (5.0) dashboard WIP
{
"__inputs": [
{
"name": "DS_PROM-V1",
"label": "prom-v1",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
@mindw
mindw / prepull.yaml
Last active December 17, 2017 17:58 — forked from itaysk/prepull.yaml
Kubernetes: Pre-pull images into node
apiVersion: apps/v1beta1
kind: DaemonSet
metadata:
name: prepull
spec:
selector:
matchLabels:
name: prepull
template:
metadata:
@mindw
mindw / node-exporter
Last active October 2, 2023 06:27 — forked from wallentx/node-exporter
node-exporter init script for Amazon AMI/RHEL to be used with systemd. Place in /etc/init.d/ and ensure that line 12 matches your path
#!/bin/bash
#
#
#
# Start on runlevels 3, 4 and 5. Start late, kill early.
# chkconfig: 345 95 05
#
#
#!/bin/bash
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
int main() {
// your code goes here
double sum = 0;
const char *input = "300 - 400";
// const char *input = "1 + 3 / 5 * 8";