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
apiVersion: v1 | |
kind: ReplicationController | |
metadata: | |
name: kube-registry-v0 | |
namespace: kube-system | |
labels: | |
k8s-app: kube-registry | |
version: v0 | |
spec: | |
replicas: 1 |
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
SHELL := /bin/sh | |
clean: | |
@rm -f .coverage 2> /dev/null | |
@rm -rf .cache 2> /dev/null | |
@find . -name "*.pyc" -delete | |
@find . -name "*.swp" -delete | |
@find . -name "__pycache__" -delete | |
sort: |
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 python:3.7.3-slim-stretch | |
WORKDIR /app | |
COPY Pipfile* ./ | |
RUN apt-get update -y && apt-get install git -y && apt-get clean -y | |
RUN pip install pipenv |
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
SHELL := /bin/sh | |
clean: | |
@rm -f .coverage 2> /dev/null | |
@rm -rf .cache 2> /dev/null | |
@find . -name "*.pyc" -delete | |
@find . -name "*.swp" -delete | |
@find . -name "__pycache__" -delete | |
format: |
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
kubectl apply -f jenkins-pv-pcv.yaml | |
# install jenkins with helm | |
# chart doc https://github.com/helm/charts/tree/master/stable/jenkins | |
helm install --name jenkins --set Persistence.ExistingClaim=jenkins --set Master.ServiceType=NodePort --set Master.NodePort=30808 --namespace devops stable/jenkins | |
# role binding | |
kubectl create rolebinding sa-devops-role-clusteradmin --clusterrole=cluster-admin --serviceaccount=devops:default --namespace=devops | |
kubectl create rolebinding sa-devops-role-clusteradmin-kubesystem --clusterrole=cluster-admin --serviceaccount=devops:default --namespace=kube-system |
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
# Ask for the user password | |
# Script only works if sudo caches the password for a few minutes | |
sudo true | |
# Install kernel extra's to enable docker aufs support | |
# sudo apt-get -y install linux-image-extra-$(uname -r) | |
# Add Docker PPA and install latest version | |
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | |
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list" |
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
job = 'b5ff7064-d3cb-4886-964d-418baa1f341c' | |
candidates = Candidate.objects.filter(candidate__userprofile__country__icontains='bra') | |
list_expected = State.objects.filter(country__language_code='pt-br').values_list('shortname', flat=True) | |
states_name = State.objects.filter(country__language_code='pt-br').values_list('name', flat=True) | |
# chaves usadas extraidas em variavies para diminuir a repetição | |
_state_key , candidate_pk = 'candidate__userprofile__state', 'candidate__pk' | |
# coloca os estado em um dicionario ex: {'SAO PAULO': SP} | |
states_dict = {} |
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 unicodedata | |
from collections import Counter | |
list_cand = [] | |
for value in qs: | |
data ={} | |
if value['key'] is not None: | |
word = value['key'] | |
target = unicodedata.normalize('NFKD', word).encode('ASCII','ignore').decode('ASCII').lower().strip() | |
data['key'] = target |
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 unicodedata import normalize | |
data = {} | |
for qs in queryset: | |
# remove os ascentos | |
target = normalize('NFKD', qs).encode('ASCII','ignore').decode('ASCII').title().strip() | |
data[target] = target | |
# orderna os items de um dict ou list | |
data_sorterd = sorted(data.items(), key=lambda kv: kv[1]) |
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 django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode, force_bytes, force_text | |
urlsafe_base64_encode(force_bytes(user.pk)) | |
user_id = urlsafe_base64_decode(force_text(uidb64)) | |
user = get_object_or_404(get_user_model(), pk=user_id) |