Skip to content

Instantly share code, notes, and snippets.

View arthurazs's full-sized avatar

Arthur Zopellaro arthurazs

  • Niterói, RJ - Brazil
  • 20:55 (UTC -03:00)
View GitHub Profile
@arthurazs
arthurazs / python310rasp.md
Created December 4, 2023 18:52
Python 3.10 download, compile and install on Raspberry Pi
View python310rasp.md
wget https://www.python.org/ftp/python/3.10.7/Python-3.10.7.tar.xz
tar -xf Python-3.10.7.tar.xz
cd Python-3.10.7/
./configure --enable-optimizations
sudo make altinstall
@arthurazs
arthurazs / intereset_rate.png
Last active March 28, 2021 17:00
Brazilian intereset rate history plot
View mn-cento7.md
sudo yum update -y

sudo yum -y install openssh-server
sudo chkconfig sshd on
sudo service sshd start
sudo setenforce Permissive
View numpy_encryption.py
# inspired by
# https://www.datasciencedata.com/2018/09/encryption-using-matrix-python.html
import numpy as np
from string import ascii_lowercase
ck = np.matrix = [[2, 1], [3, 2]] # Encryption key
dk = np.matrix = [[2, -1], [-3, 2]] # Decryption key
code_to_text = {}
@arthurazs
arthurazs / xubuntu.md
Last active April 3, 2019 20:29
Xubuntu -> AuthFlow w/ Mininet
View xubuntu.md

Xubuntu

keyboard -> Application Shortcut: xfce4-popup-whiskermenu -> Super L

sudo sed -i '$a arthurazs ALL=(ALL) NOPASSWD:ALL' /etc/sudoers
sed -i '$a alias apt="sudo apt"' ~/.bashrc
@arthurazs
arthurazs / install_ryu.sh
Created August 17, 2018 06:03
Install Ryu in Mininet VM
View install_ryu.sh
sudo apt update
sudo apt install python-pip python-dev -y
pip install ryu --user --upgrade
echo "export PATH=~/.local/bin:$PATH" >> ~/.bashrc
source ~/.bashrc
echo "done, checking installation..."
ryu --version
@arthurazs
arthurazs / deep_example.py
Created July 22, 2018 02:16
Simple deep learning example (node + weight + relu)
View deep_example.py
import numpy as np
from sys import argv
def relu(input_value):
output_value = max(0, input_value)
return output_value
children = int(argv[1])
accounts = int(argv[2])
@arthurazs
arthurazs / bs4_requests.py
Created July 22, 2018 02:10
Simple requests + bs4 example
View bs4_requests.py
from bs4 import BeautifulSoup
from requests import get as req_get
# Stating the bot's identification
headers = {'user-agent': 'topsongs:v0.1.0 by me@mail.com'}
url = 'http://www.billboard.com/charts/billboard-200'
request = req_get(url, headers=headers)
request.raise_for_status() # in case something goes wrong
@arthurazs
arthurazs / 1_repr_random_behaviour.md
Last active February 8, 2018 02:59
__repr__ function with randomness and object behaviour in Python
View 1_repr_random_behaviour.md

TL;DR __repr__ should help us recreate an object even if it has random behaviour or if it changes itself during runtime. Check the final Deck Class.

>>> deck1 = Deck(5)  # Unseeded Deck 1 without extra behaviour
[0, 3, 4, 2, 1]
>>> deck2 = Deck(5)  # Unseeded Deck 2 without extra behaviour, different from Deck 1
[3, 4, 1, 2, 0]
>>> repr(deck1)  # Deck 1's current state
Deck(5, 777611, 0)
>>> repr(deck2)  # Deck 2's current state
View PyPI Readme.md

.md to .rst

$ apt install pandoc
$ cd git/dotapatch
$ pandoc --from=markdown --to=rst --output=PyPIREADME.rst README.md 

Test here

.pypirc