Skip to content

Instantly share code, notes, and snippets.

View andrealmar's full-sized avatar
🏠
Working from home

Andre Almar andrealmar

🏠
Working from home
View GitHub Profile
virtualenv -p /Users/andrealmar/.pyenv/versions/3.6.0/bin/python .venv
# JSON Resume
[JSON Resume] is an easy way to produce an adaptible and professional-looking resume. We recommend that you use it. It'll save you a lot of headaches about formatting, file types, and the like. Plus, it'll make you look like you know how to Internet.
This is what the underlying format looks like:
```
{
"basics": {
"name": "John Doe",
"label": "Programmer",
on settings.py change the DATABASES config to something like this:
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": "[YOUR_DATABASE_NAME]",
"USER": "[YOUR_USER_NAME]",
"PASSWORD": "",
"HOST": "localhost",
"PORT": "",
@andrealmar
andrealmar / beautiful_idiomatic_python.md
Created May 23, 2017 04:00 — forked from JeffPaine/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]:
-p # port binding eg.HOST:CONTAINER - 5433:5432
-e # env variabls
# Run a container mounting an outside volume inside the container
docker run -it -v /Users/andrealmar/primeiro_dockerfile/:/volume alpine
# Inspect mounted volume of a Container
docker inspect -f {{.Mounts}} 8a73d606bd9c
# creating and executing a PostgreSQL container using another container as a Volume
@andrealmar
andrealmar / latency.txt
Created September 29, 2017 20:12 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@andrealmar
andrealmar / vi_find_replace.txt
Created November 28, 2017 11:49
vi find and replace
Então mudaremos, na própria linha de comando do vi, a palavra "amamu" pelo correto, amamos.
Sendo key-sensitive a utilização deste comando, execute:
:%s/amamu/amamos/g
# TO RUN the WLST script just type the command below:
# /webtools/oracle/plat1200_1/middleware/oracle_common/common/bin/wlst.sh weblogic_ad_users.py
# Author: ANDRE ALMAR
servidor = raw_input('Digite o servidor: ')
porta = raw_input('Digite a porta: ')
usuario = raw_input('Digite o usuario: ')
password = raw_input('Digite o password: ')
roles = ['Deployer', 'Monitor', 'Operator', 'IntegrationDeployer', 'IntegrationMonitor', 'IntegrationOperator']
# Author: Andre Almar - [email protected]
import os, subprocess
from subprocess import call
print 'Validando FileSystem /webaplic'
if os.path.isdir('/webaplic'):
print "Diretorio /webaplic ja existe"
else:
try:
du -sh /var/* | sort -n