This file contains hidden or 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
# List files recursively with Human-readable size | |
ls -lhR | |
# Human-readable with filesystem type | |
df -hT | |
# Show top-level directory sizes | |
du -h --max-depth=1 / | sort -hr | head -20 | |
# Current directory breakdown |
This file contains hidden or 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
# https://kubernetes.io/docs/reference/kubectl/quick-reference/ | |
# use k for shorthand alias | |
alias k=kubectl | |
# context and configuration | |
kubectl config view | |
kubectl config get-contexts | |
kubectl config set-cluster my-cluster-name # set a cluster entry in the kubeconfig |
This file contains hidden or 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
# https://helm.sh/docs/intro/cheatsheet/ | |
# Chart Management | |
helm create <name> # Creates a chart directory along with the common files and directories used in a chart. | |
helm package <chart-path> # Packages a chart into a versioned chart archive file. | |
helm lint <chart> # Run tests to examine a chart and identify possible issues: | |
helm show all <chart> # Inspect a chart and list its contents: | |
helm show values <chart> # Displays the contents of the values.yaml file | |
helm pull <chart> # Download/pull chart | |
helm pull <chart> --untar=true # If set to true, will untar the chart after downloading it |
This file contains hidden or 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, delete, rename a user without privileges*/ | |
CREATE ROLE ben; | |
DROP ROLE ben; | |
ALTER ROLE ben RENAME TO benji; | |
/* create a user with privileges*/ | |
CREATE ROLE ben LOGIN CREATEDB CREATEROLE REPLICATION; | |
/* Add privileges to existing user*/ | |
ALTER ROLE ben WITH LOGIN CREATEROLE CREATEDB REPLICATION; |
This file contains hidden or 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
def chunks(seq, n=5): | |
"""apply to users hotelcode. 'aaaaabbbbb' becomes ('aaaaa', 'bbbbb')""" | |
return tuple((seq[i:i+n] for i in range(0, len(seq), n))) | |
@app.route("/search", methods=["GET", "POST"]) | |
@login_required | |
def search(): | |
# test/check for access | |
if "BB" not in chunks(current_user.access, n=2): abort(401) |
This file contains hidden or 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
cat ~/.ssh/id_rsa.pub | ssh <user>@<hostname> 'cat >> .ssh/authorized_keys && echo "Key copied"' | |
# Debug Docker Container | |
run --rm -it --entrypoint /bin/bash <image> |
This file contains hidden or 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
# hipandas.py | |
"""Useful Tips | |
column: axis=1 | |
rough rule: back-to-back ][ square brackets, you're asking for trouble | |
Replace that with a .loc[..., ...] and you'll be set. | |
.loc label-based indexing | |
.iloc for positional indexing | |
""" | |
import os | |
import pandas as pd |