Skip to content

Instantly share code, notes, and snippets.

kubectl --kubeconfig kube_config_cluster.yml get configmap -n kube-system full-cluster-state -o json | jq -r .data.\"full-cluster-state\" | jq -r . > cluster.rkestate
alias archtree='ps ww -o sid,pgid,pid,args --forest -s `cat /var/run/supervisord.pid`'
@tjhartmann
tjhartmann / ipv4.py
Last active August 29, 2015 14:18 — forked from cslarsen/ipv4.py
#!/usr/bin/env python
"""Functions to convert IPv4 address to integer and vice-versa.
Written by Christian Stigen Larsen, http://csl.sublevel3.org
Placed in the public domain by the author, 2012-01-11
Example usage:
$ ./ipv4 192.168.0.1 3232235521
192.168.0.1 ==> 3232235521
@tjhartmann
tjhartmann / GDB hack
Last active August 29, 2015 14:10
Force running process to exit(0)
gdb --batch --eval-command 'call exit(0)' --pid <process id>
@tjhartmann
tjhartmann / MegaRAID
Last active March 5, 2021 23:23
Useful Linux storage commands
# concise logical disk enumeration
MegaCli -LDInfo -Lall -aAll | egrep 'Size|State|Number|Adapter|Virtual'
# concise physical disks enumeration
MegaCli -PDList -aALL | egrep 'Enclosure|Raw Size|Slot Number|Device Id|Firmware state|Inquiry|Adapter'
@tjhartmann
tjhartmann / yum chroot
Last active December 20, 2015 07:09
Using yum to build chroot
mkdir /path/to/chroot
rpm --root /path/to/chroot --initdb
wget http://repo_url/centos-release-version.rpm
rpm -i --nodeps --root /path/to/chroot /path/to/centos-release-version.rpm
yum --installroot=/path/to/chroot --nogpgcheck install -y yum rpm-build
# -or-
yum --installroot=/path/to/chroot --nogpgcheck groupinstall -y Base
# to use yum inside the chroot
@tjhartmann
tjhartmann / initrd
Last active December 20, 2015 04:29
Initrd foo
# extract old initrd
mkdir newinitrd
cd newinitrd
zcat ../oldinitrd.img | cpio -ivd
# make changes
# create new initrd
find . | cpio -o -H newc | gzip > /tmp/newinitrd
@tjhartmann
tjhartmann / AD DNS CLI
Last active December 19, 2015 21:48
Python AD LDAP
dnscmd.exe <DNS Server> /RecordAdd domain.com hostname /CreatePTR A ipaddress