Skip to content

Instantly share code, notes, and snippets.

View ob1-sc's full-sized avatar

Simon O'Brien ob1-sc

  • VMware
  • United Kingdom
View GitHub Profile
@ob1-sc
ob1-sc / delete-files.md
Created January 6, 2021 14:21
Delete files older than x days
find /path/to/files -type f -mtime +7 -name '*.*' -print0 | xargs -r0 rm --
@ob1-sc
ob1-sc / git-crypt.md
Last active June 3, 2022 15:38
Setup git-crypt

install

sudo apt install git-crypt

init your git repo

cd <root of git repo>
git-crypt init
@ob1-sc
ob1-sc / mac-learning.md
Last active September 3, 2020 08:57
Setup Distributed Switch Mac Learning
  1. Download William Lam scripts and browse to correct folder
git clone https://github.com/lamw/vghetto-scripts.git
cd powershell
  1. Install powershell
$ sudo snap install powershell --classic
@ob1-sc
ob1-sc / homelab-notes
Last active July 16, 2020 15:04
Homelab Notes
** Untangle
* Ensure interfaces are correctly mapped
* Set Hostname => Domain Name
* Add DNS entries
* Allows DNS from WAN interfaces
* Turn off nat on all interfaces
* Add standalone NAT rule for EXTERNAL (Destination => WAN interface | Source => Any NON WAN interface)
@ob1-sc
ob1-sc / ipmi-fan-speed
Last active August 6, 2023 10:45
IPMI Fan Config
sudo apt install ipmitool
sudo ipmitool -H <hostname> -U <username>
sudo ipmitool -H <hostname> -U <username> sensor list all
sudo ipmitool -H <hostname> -U <username> sensor thresh FAN1 lower 100 200 300
sudo ipmitool -H <hostname> -U <username> sensor thresh FAN2 lower 000 000 100
sudo ipmitool -H <hostname> -U <username> sensor thresh FAN4 lower 000 000 100
@ob1-sc
ob1-sc / ssh-old-cypher
Last active April 29, 2020 11:49
ssh connect with old cypher
ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -c <old cypher> <user>@<server>
@ob1-sc
ob1-sc / gist:08236f8cca765a5ad5c3c67da0595ef0
Created April 15, 2020 09:43
Postgres user and db creation
REVOKE CREATE ON SCHEMA public FROM PUBLIC;
CREATE ROLE <db_owner> WITH LOGIN PASSWORD '<db_owner_password>';
CREATE DATABASE <db_name> WITH OWNER=<db_owner>;
REVOKE ALL ON DATABASE <db_name> FROM public;
GRANT ALL ON DATABASE <db_name> TO <db_owner>;
@ob1-sc
ob1-sc / k8s.md
Last active May 16, 2020 11:45
k8s

Misc

Get X based on label (AND)

kubectl get pods --selector=bu=finance,tier=frontend,env=prod

Get X based on label (OR)

kubectl get pods --selector='env in (dev,prod)'
@ob1-sc
ob1-sc / gist:0dd2b3a0a0bac38a29b3d72179bc9c2b
Created October 31, 2019 07:24
Pipeline Common Tasks Yaml Anchor
interpolate-creds: &interpolate-creds
do:
- task: tfstate-interpolate
image: platform-automation-image
...
...
- task: credhub-interpolate
...
...
etc
export OM_KEY=om.pem
terraform output ops_manager_ssh_private_key > $OM_KEY
chmod 0600 $OM_KEY
CREDS=$(om -t $OM_TARGET --skip-ssl-validation curl --silent \
-p /api/v0/deployed/director/credentials/bosh_commandline_credentials | \
jq -r .credential | sed 's/bosh //g')
# this will set BOSH_CLIENT, BOSH_ENVIRONMENT, BOSH_CLIENT_SECRET, and BOSH_CA_CERT
# however, BOSH_CA_CERT will be a path that is only valid on the OM VM