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
delete-namespace: check-cluster | |
kubectl delete namespace sandbox | |
check-cluster: | |
@if [ -z "$(CI)" ]; then current_context=$(shell kubectl config current-context); \ | |
echo "The current context is `tput bold`$$current_context`tput sgr0`."; \ | |
read -p "Is this the correct context? (y/n): " answer; if [ "$$answer" != "y" ]; \ | |
then echo "Aborted."; exit 1; fi; echo "Proceeding..."; \ | |
fi |
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
kdecsec(){kubectl get secret $1 -o go-template='{{range $k,$v := .data}}{{printf "%s => " $k}}{{if not $v}}{{$v}}{{else}}{{$v | base64decode}}{{end}}{{"\n"}}{{end}}';} | |
kgpf(){kubectl get svc -o json | jq '.items[] | {name:.metadata.name, p:.spec.ports[] } | select( .p.nodePort != null ) | "\(.name): localhost:\(.p.nodePort) -> \(.p.port) -> \(.p.targetPort)"';} |
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
# Show disk space info for all pod | |
n=mynamespace bash -c 'for pod in $(kubectl get pods -n $n -o=jsonpath="{.items[*].metadata.name}"); do echo $pod; kubectl exec -it $pod -n $n -- df -h; echo "\n"; done' |
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
gem 'devise', '3.2.4' | |
gem 'simple_token_authentication', '1.5.0' |
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
# from: https://gist.github.com/phizaz/20c36c6734878c6ec053245a477572ec | |
import asyncio | |
import functools | |
import asyncio | |
def force_async(fn): | |
''' | |
turns a sync function to async function using threads | |
''' | |
from concurrent.futures import ThreadPoolExecutor |
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
from osgeo import gdal | |
raster_file = "some_geotiff.tif" | |
print("gdal.__version__:", gdal.__version__) | |
print("############ Get STATS using GetStatistics() ############") | |
ds = gdal.Open(raster_file) | |
band_count = ds.RasterCount | |
print("band_count:", band_count) |
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
git filter-branch --env-filter ' | |
WRONG_EMAIL="[email protected]" | |
NEW_NAME="New Name Value" | |
NEW_EMAIL="[email protected]" | |
if [ "$GIT_COMMITTER_EMAIL" = "$WRONG_EMAIL" ] | |
then | |
export GIT_COMMITTER_NAME="$NEW_NAME" | |
export GIT_COMMITTER_EMAIL="$NEW_EMAIL" | |
fi |
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
import json | |
def mapper(source, template): | |
def _get(d, keys, splitter="."): | |
if isinstance(keys, str): | |
keys = keys.split(splitter)[1:] | |
if not keys or d is None: | |
return d |
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
#!/usr/bin/env bash | |
while getopts u:d:p:b: option | |
do | |
case "${option}" | |
in | |
u) _USER=${OPTARG};; | |
p) _PASSWORD=${OPTARG};; | |
b) _BUILD=${OPTARG};; | |
esac |
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
import flask | |
import requests | |
from flask import Flask | |
from flask_restful import Resource, Api | |
from PIL import Image, ImageDraw, ImageFont | |
from io import BytesIO | |
app = Flask(__name__) | |
api = Api(app) |
NewerOlder