Skip to content

Instantly share code, notes, and snippets.

@azengard
azengard / .bash_history
Created June 29, 2017 21:55
Configuration history for bash on windows with HB setup.
cd ~
sudo apt install git
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
exec $SHELL
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
@azengard
azengard / .bashrc
Created September 15, 2017 05:03
Bashrc config for pyenv HB env config
### PYENV
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
export WORKON_HOME=~/.ve
export PROJECT_HOME=~/workspace
eval "$(pyenv init -)"
pyenv virtualenvwrapper_lazy
### ALIAS PYTHON DJANGO VIRTUALENV
alias manage='python $(cat $(echo $VIRTUAL_ENV/.project))/manage.py'
from math import ceil, floor
def round_2_down(number):
"""Arredonda 2 casas sempre para baixo"""
if number < 0:
return ceil(number * 100)/100
return floor(number * 100)/100
"""
13. wordcount
Este desafio é um programa que conta palavras de um arquivo qualquer de duas
formas diferentes.
A. Lista todas as palavras por ordem alfabética indicando suas ocorrências.
Ou seja...
"""Geometry"""
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def __eq__(self, other):
return self.x == other.x and self.y == other.y
from itertools import zip_longest
class Bits(bytes):
CHUNK = 8
def __new__(cls, n):
return super().__new__(cls, cls.number_to_bits(n))
@staticmethod
import pytest
class IntervalMap:
def __init__(self):
self.limits = []
self.map = {}
def __setitem__(self, upper_bound, value):
self.limits.append(upper_bound)
import pytest
class IntervalMap:
def __init__(self):
self.limits = []
self.map = {}
def __setitem__(self, upper_bound, value):
self.limits.append(upper_bound)
<md:EntityDescriptor xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" validUntil="2022-02-06T11:46:24Z" cacheDuration="PT604800S" entityID="http://localhost:8000/metadata/">
<md:SPSSODescriptor AuthnRequestsSigned="true" WantAssertionsSigned="false" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol">
<md:KeyDescriptor use="signing">
<ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:X509Data>
<ds:X509Certificate>MIIGGTCCBAGgAwIBAgIUenvymK3dUpRDWbJRiCGdP+AeDHAwDQYJKoZIhvcNAQELBQAwgZsxCzAJBgNVBAYTAkJSMQswCQYDVQQIDAJTUDESMBAGA1UEBwwJc2FvIHBhdWxvMRowGAYDVQQKDBFTa3kuT25lIFNvbHV0aW9uczEQMA4GA1UECwwHU2t5Lk9uZTEWMBQGA1UEAwwNbG9jYWxob3N0LmNvbTElMCMGCSqGSIb3DQEJARYWYWRtaW5Ac2t5b25lLnNvbHV0aW9uczAeFw0yMjAxMzExNTA0MDFaFw0zMjAxMjkxNTA0MDFaMIGbMQswCQYDVQQGEwJCUjELMAkGA1UECAwCU1AxEjAQBgNVBAcMCXNhbyBwYXVsbzEaMBgGA1UECgwRU2t5Lk9uZSBTb2x1dGlvbnMxEDAOBgNVBAsMB1NreS5PbmUxFjAUBgNVBAMMDWxvY2FsaG9zdC5jb20xJTAjBgkqhkiG9w0BCQEWFmFkbWluQHNreW9uZS5zb2x1dGlvbnMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwxu7W5Z