Skip to content

Instantly share code, notes, and snippets.

@nurlanf
nurlanf / 0.8.0-incubating-SNAPSHO-pom.xml
Created January 29, 2023 23:33 — forked from jster1357/0.8.0-incubating-SNAPSHO-pom.xml
Livy pom.xml for supporting Spark 3.1.2 and Hadoop 3
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one or more
~ contributor license agreements. See the NOTICE file distributed with
~ this work for additional information regarding copyright ownership.
~ The ASF licenses this file to You under the Apache License, Version 2.0
~ (the "License"); you may not use this file except in compliance with
~ the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: myservice-ingress
annotations:
kubernetes.io/ingress.class: nginx
spec:
rules:
- host: my.example.com
http:
@nurlanf
nurlanf / kubernetes_add_service_account_kubeconfig.sh
Last active September 14, 2020 10:26 — forked from innovia/kubernetes_add_service_account_kubeconfig.sh
Create a service account and generate a kubeconfig file for it - this will also set the default namespace for the user
#!/bin/bash
set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
fi
oldns=default
newns=somenamespace
secret=mysecret
kubectl get secret $secret --namespace=$oldns --export -o yaml | kubectl apply --namespace=$newns -f -
@nurlanf
nurlanf / extract_emails.sh
Created March 11, 2019 21:22
Useful scripts
#!/bin/bash
display_usage() {
echo "Usage: $0 <filename>"
}
if [ $# -eq 0 ]
then
display_usage
exit 1
fi
grep -o '[[:alnum:]+\.\_\-]*@[[:alnum:]+\.\_\-]*' $1 | sort | uniq -i
@nurlanf
nurlanf / gist:7cee28ed3a28253a27129b4a7be7bc3c
Created March 5, 2019 10:03 — forked from rkuzsma/gist:b9a0e342c56479f5e58d654b1341f01e
Example Kubernetes yaml to pull a private DockerHub image
Step by step how to pull a private DockerHub hosted image in a Kubernetes YML.
export DOCKER_REGISTRY_SERVER=https://index.docker.io/v1/
export DOCKER_USER=Type your dockerhub username, same as when you `docker login`
export DOCKER_EMAIL=Type your dockerhub email, same as when you `docker login`
export DOCKER_PASSWORD=Type your dockerhub pw, same as when you `docker login`
kubectl create secret docker-registry myregistrykey \
--docker-server=$DOCKER_REGISTRY_SERVER \
--docker-username=$DOCKER_USER \
@nurlanf
nurlanf / get_lat_lon_exif_pil.py
Last active February 21, 2019 22:37 — forked from erans/get_lat_lon_exif_pil.py
Get Latitude and Longitude from EXIF using PIL
from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
def get_exif_data(image):
"""Returns a dictionary from the exif data of an PIL Image item. Also converts the GPS Tags"""
exif_data = {}
info = image._getexif()
if info:
for tag, value in info.items():
decoded = TAGS.get(tag, tag)