DST=/mnt
find /var/lib -type f -size +1G -exec ls -lh {} \; | tee $DST/bigfiles_var_lib_$(date "+%H%M").log
find /var/lib -type f -size +1G -exec ls -lh {} \; | awk '{ print $5 ": " $9 }' | sort -rh > $DST/bigfiles_var_lib_$(date "+%H%M").sorted.log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubectl get job -n sre kibana-config -o json | jq 'del(.spec.selector)' | jq 'del(.spec.template.metadata.labels)' | kubectl replace --force -f - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# See more: https://gist.github.com/epcim/80d2dda18e2b3022e4ab07f161f59823 | |
# hab clustered etcd | |
## compose | |
cat <<EOF > docker-compose.yml | |
version: '3' | |
services: | |
etcd1: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000)" != "200" ]]; do sleep 5; done' | |
# also check https://gist.github.com/rgl/c2ba64b7e2a5a04d1eb65983995dce76 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# example usage: to split yaml with multiple documents | |
needle() { | |
SUFFIX=${1##*.} | |
NEEDLE=${2:----} | |
csplit -b "%03d.$SUFFIX" -zsf $(basename $1 .$SUFFIX) $1 /$NEEDLE/+1 {*} | |
} | |
needle vega-objects.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python3 | |
import gitlab | |
import sys | |
# private token or personal token authentication | |
gl = gitlab.Gitlab('https://gitlab.com/', private_token='******') | |
if len(sys.argv) > 1: | |
if sys.argv[1].find("/") > 0: |
Simple deployment script to install habitat container with the app as systemd service.
export ALT=500 # Prefix for all the service names/ports used (apply to habitat/ inner service service)
# cleanup
systemctl stop etcd-$ALT
sleep 3
rm -f /etc/systemd/system/etcd-$ALT.service /etc/default/etcd-$ALT*
rm -rf /srv/etcd-$ALT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a Custom Debian Live Environment (CD or USB) | |
https://willhaley.com/blog/custom-debian-live-environment/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rewrite part of the file from variable | |
sed -i "/^write_files:/{ | |
s/write_files://g | |
r $NET_RULES | |
}" $CLOUD_CONFIG_FILE |
CLI tool for gitlab's API:
https://python-gitlab.readthedocs.io/en/stable/cli.html
pip3 install --user python-gitlab
$EDITOR ~/.python-gitlab.cfg
Sample config for gitlab's main site, but you can add your own local instances too:
[global]