Skip to content

Instantly share code, notes, and snippets.

View zeandrade's full-sized avatar
🏠
At Home

Zé Roberto Andrade Jr. zeandrade

🏠
At Home
  • home
  • Curitiba, Brasil
View GitHub Profile
@zeandrade
zeandrade / size.py
Last active July 4, 2018 15:14 — forked from cbwar/size.py
Python: Human readable file size
def sizeof_fmt(num, iec=True):
"""Readable file size
:param num: Bytes value
:type num: int
:param iec: default True, set iec pattern (powers of 1024),
False set si pattern (powers of 1000)
:type iec: boolean
:rtype: str
"""

Keybase proof

I hereby claim:

  • I am zeandrade on github.
  • I am zeroandrade (https://keybase.io/zeroandrade) on keybase.
  • I have a public key ASASRbsE9hxyICg5CujkrxMIpkmA8mqcKT0VgiZ9QS8nPgo

To claim this, I am signing this object:

@zeandrade
zeandrade / Verifying my Peepeth
Last active May 25, 2019 06:37
Verifying my Peepeth
Verifying my identity on Peepeth.com 0x0ab2ad1e52a78fa2534025bb222130219f2f03cc
@zeandrade
zeandrade / tr_sal.py
Created June 3, 2019 14:41
Script to display squid's access log output in human-readable format.
#!/usr/bin/env python3
'''
Translate the squid access log output to an human friendly format.
- copy this script to some $PATH dir (ex. /usr/local/bin)
- set permission: chmod a+x tr_sal.py
usage: zcat /path/log/access.log.gz | tr_sal.py
cat /path/log/access.log | tr_sal.py -s > ~/myfile.txt
tail -F /path/log/access.log | tr_sal.py -s | less
@zeandrade
zeandrade / random_password.sh
Created May 11, 2021 18:59
generate a random password and save the string in a PDF file
# !/bin/sh
# generate a random password and save the string in a PDF file
# 7 letters ( upppers and lowers), except "l" and "O" to better legibility
# 4 numbers (1 to 9)
# 3 special chars of @,! or _
convert --version > /dev/null 2>/dev/null || (echo "Error: you need imagemagick" && exit )
passwd_p1=`tr -dc 'A-NQ-Za-km-z' </dev/urandom | head -c 7`
passwd_p2=`tr -dc '1-9' </dev/urandom | head -c 4`
passwd_p3=`tr -dc '@!_' </dev/urandom | head -c 3`