Instantly share code, notes, and snippets.

View vscode_extensions.sh
ssh 192.168.96.93 -c "code --list-extensions | xargs -L 1 echo code-insider --install-extension"
View apfs_volume.sh
diskutil apfs addVolume disk1 APFS Steam
ln -s /Volumes/Steam ~/Library/Application\ Support/Steam
View get_server_cert.sh
#!/bin/bash
export SERVER=${SERVER:-localhost}
echo | openssl s_client -showcerts -servername $SERVER -connect $SERVER:443 2>/dev/null | openssl x509 -inform pem -noout -text
View ML_DEMO.md

OVERVIEW

Openstack

Nova:

  • PCI PASSTHROUGH
  • FLAVOR

Device:

View k8s_pvc_pv_selector.md

https://stackoverflow.com/questions/49344501/how-can-you-reuse-dynamically-provisioned-persistentvolumes-with-helm-on-gke

PersistenVolumeClain creating just a mapping between your actual PersistentVolume and your pod.

Using "helm.sh/resource-policy": keep annotation for PV is not the best idea, because of that remark in a documentation:

The annotation "helm.sh/resource-policy": keep instructs Tiller to skip this resource during a helm delete operation. However, this resource becomes orphaned. Helm will no longer manage it in any way. This can lead to problems if using helm install --replace on a release that has already been deleted, but has kept resources.

If you will create a PV manually after you will delete your release, Helm will remove PVC, which will be marked as "Available" and on next deployment, it will reuse it. Actually, you don't need to keep your PVC in the cluster to keep your data. But, for making it always using the same PV, you need to use labels and selectors.

View kubeconfig_multiple.sh
# apple
# https://brew.sh
brew install kubectx fzf
# other
# https://github.com/ahmetb/kubectx
# https://github.com/junegunn/fzf
# you may want to configure your fzf shell bindings/completition
# check /usr/local/opt/fzf/shell/*
View reclass_topology_from_cluster.sh
rm -rf new
mkdir -p new
# set init.yml pointing to default.yml
function i() {
# i() path/top/default.yml
# i() path/top/default
# i() path/top
if [[ "$(basename $1)" == "default" ]]; then
View jq-cheetsheet.md

Processing JSON using jq

jq is useful to slice, filter, map and transform structured json data.

Installing jq

On Mac OS

brew install jq

View Terraform_functions.md

Supported built-in functions

  • abs(float) - Returns the absolute value of a given float. Example: abs(1) returns 1, and abs(-1) would also return 1, whereas abs(-3.14) would return 3.14. See also the signum function.

  • basename(path) - Returns the last element of a path.

  • base64decode(string) - Given a base64-encoded string, decodes it and returns the original string.

View maas-squashfs-backdoor.sh
https://gnu-linux.org/building-ubuntu-rootfs-for-arm.html
"2) Extract the downloaded image with ‘sudo’ to allow ‘mknod’ commands to work"
# get a cloud image from here
# https://cloud-images.ubuntu.com/daily/server/xenial/
# https://cloud-images.ubuntu.com/daily/server/xenial/current/
# based on https://bazaar.launchpad.net/~maas-images-maintainers/maas-images/maas-ephemerals/view/head:/bin/img2squashfs#L161
# extract a cloud image rootfs to a directory, sudo is needed for `mknod`s to work
# doesn't have to be .tar.gz - could well unsquashfs an existing squashfs