Skip to content

Instantly share code, notes, and snippets.

View glauesppen's full-sized avatar
:octocat:
Focusing

Glaucia Esppenchutz glauesppen

:octocat:
Focusing
View GitHub Profile
@GusAntoniassi
GusAntoniassi / README.md
Last active July 3, 2024 19:47
Configure autocompletion to kubectl with zsh

kubectl with ZSH (oh-my-zsh)

How to configure

Use the following commands to add the kubectl autocomplete to zsh:

mkdir -p ~/.oh-my-zsh/custom/plugins/kubectl-autocomplete/
kubectl completion zsh > ~/.oh-my-zsh/custom/plugins/kubectl-autocomplete/kubectl-autocomplete.plugin.zsh
@dmmeteo
dmmeteo / 1.srp.py
Last active June 7, 2024 14:11
SOLID Principles explained in Python with examples.
"""
Single Responsibility Principle
“…You had one job” — Loki to Skurge in Thor: Ragnarok
A class should have only one job.
If a class has more than one responsibility, it becomes coupled.
A change to one responsibility results to modification of the other responsibility.
"""
class Animal:
def __init__(self, name: str):
@DrSensor
DrSensor / Advanced Markdown Tricks.md
Last active June 25, 2024 02:33
Advanced Markdown Tricks

Repository

What Will I Learn?

In general, you will learn some markdown tricks combined with standard HTML tags. In more details what you will learn:

  • Hide-show content
  • Writing codeblocks inside codeblocks
  • Combining and using italic, bold, superscript, subscript, and/or strikethrough
  • Quoting long sentence (using nested blockquotes)
from novo_financeiro.models import *
leilao = 'DIVSC05-17'
for nota in Nota.objects.filter(cache_dicionario__contains=leilao):
dicionario = nota.dicionario_do_cache()
dicionario['taxas'] = 0
nota.cache_dicionario = json.dumps(dicionario, cls=DjangoJSONEncoder)
nota.save()
from django.core.mail import EmailMessage
from contato.models import Newsletter
from django.contrib.auth.models import User
emails = ['lopinho@gmail.com']
newsletter = set(Newsletter.objects.values_list('email', flat=True))
cadastrados = set(User.objects.filter(email__in=newsletter).values_list('email', flat=True))
fora_do_site = newsletter - cadastrados
from leilao.models import LanceProgramado
leilao = 'SEOP15-17'
lote = 2795
username = 'shirlene'
LanceProgramado.objects.filter(
lote__numero_do_lote_no_leilao=lote,
lote__leilao__nome=leilao,
user__username=username).values_list('ativo', flat=True)
@alexcasalboni
alexcasalboni / amazon-rekognition.md
Last active July 6, 2024 03:43
Amazon Rekognition - Python Code Samples

Amazon Rekognition - Python Code Samples

  1. Labels Detection
  2. Faces Detection
  3. Faces Comparison
  4. Faces Indexing
  5. Faces Search
@mpneuried
mpneuried / Makefile
Last active July 7, 2024 14:30
Simple Makefile to build, run, tag and publish a docker containier to AWS-ECR
# import config.
# You can change the default config with `make cnf="config_special.env" build`
cnf ?= config.env
include $(cnf)
export $(shell sed 's/=.*//' $(cnf))
# import deploy config
# You can change the default deploy config with `make cnf="deploy_special.env" release`
dpl ?= deploy.env
include $(dpl)
@marians
marians / CouchDB_Python.md
Last active May 21, 2024 20:53
The missing Python couchdb tutorial

This is an unofficial manual for the couchdb Python module I wish I had had.

Installation

pip install couchdb

Importing the module

@kelvintaywl
kelvintaywl / split.py
Last active May 9, 2024 11:39
Python Script to split CSV files into smaller files based on number of lines
import csv
import sys
import os
# example usage: python split.py example.csv 200
# above command would split the `example.csv` into smaller CSV files of 200 rows each (with header included)
# if example.csv has 401 rows for instance, this creates 3 files in same directory:
# - `example_1.csv` (row 1 - 200)
# - `example_2.csv` (row 201 - 400)
# - `example_3.csv` (row 401)