Skip to content

Instantly share code, notes, and snippets.

View mmastoras's full-sized avatar

Mark Mastoras mmastoras

  • nClouds
  • San Bruno, California
View GitHub Profile
@mmastoras
mmastoras / gist:2039097
Last active November 15, 2024 17:59
some helpful git commands
setup local branch tracking a remote feature branch
====================================================
git checkout -b <feature branch name> origin/<feature_branch_name>
create new feature branch
=========================
git checkout master
git checkout -b <feature branch name>
create a new local branch tracking a remote branch
@mmastoras
mmastoras / gist:69b85e34d9634c9dc9de4766e2d14aa0
Last active June 27, 2024 22:29
journalctl most recent (systemd, systemctl)
// get journal logs from systemd services
# journalctl -u <service name>.service
# journalctl -u <service name>.service -n 100 --no-pager
# run bash in a specific container image
docker run -it <image> /bin/bash
# run bash and mount a local volume into a specific contaimer image
docker run -it -v $(pwd):/pki-tools/pki dprails/pki-tools /bin/bash
# run a x86 docker image on M1 mac
docker run -it --platform linux/amd64 -v $(pwd):/pki-tools/pki dprails/pki-tools /bin/bash
# build on m1 mac
@mmastoras
mmastoras / gist:11d438eafd9581206b547b2004348ba6
Last active January 24, 2024 22:31
kubectl cheat sheet
# get logs from a pod
$ kubectl logs -f <pod name> --namespace <namespace>
# get logs from a specific container in a pod
$ kubectl logs -f <pod name> -c <container> -n <namespace>
# get logs across several containers
$ kubectl logs -l istio=ingressgateway -n istio-system -c ingress-sds # by using label
# get list of pods and observe their logs
@mmastoras
mmastoras / port checks
Last active May 23, 2023 18:46
Port checks + network troubleshooting
$ nc -vz -u 10.100.0.10 53
Connection to 10.100.0.10 53 port [udp/domain] succeeded!
# nc -vz 10.100.0.10 443
Connection to 10.100.0.10 443 port [tcp/*] succeeded!
@mmastoras
mmastoras / dpkg lock
Last active June 20, 2022 23:07
dpkg lock
#!/bin/bash
apt-get update
apt-get install -y psmisc
i="0"
while [ $i -lt 10 ]
do
if [ $(fuser /var/lib/dpkg/lock) ]; then
@mmastoras
mmastoras / gist:2ae343e88ea3a0d6240d7950934b84a2
Created March 23, 2022 15:54
upload community cookbooks to chef server
knife supermarket search openssh
knife supermarket download openssh
tar -xzvf openssh-2.10.3.tar.gz
knife supermarket download iptables
tar -xzvf iptables-8.0.0.tar.gz
knife cookbook upload iptables
knife cookbook upload openssh

Create Root CA (Done once)

Create Root Key

Attention: this is the key used to sign the certificate requests, anyone holding this can sign certificates on your behalf. So keep it in a safe place!

openssl genrsa -des3 -out rootCA.key 4096
# get status of a job
$ nomad job status -no-color kafka-broker
ID = kafka-broker
Name = kafka-broker
Submit Date = 2019-07-24T14:03:41-07:00
Type = service
Priority = 50
Datacenters = alpha
Status = dead
Periodic = false
@mmastoras
mmastoras / Influx_grafana
Last active March 30, 2020 19:39
Influx cheatsheet
$ influx -ssl -host <host> -port <port>
# select database
> use <database name>
# set time format
> precision rfc3339
# show all measurements
> show measurements