Skip to content

Instantly share code, notes, and snippets.

@mtcarvalho
mtcarvalho / whatsapp_send_msg_urls.txt
Created March 31, 2021 02:19
whatsapp web api: send message to number without adding it to agenda
windows: https://api.whatsapp.com/send?phone=<number_with_country_code>
linux: https://web.whatsapp.com/send?phone=<number_with_country_code>
@mtcarvalho
mtcarvalho / cygwin-essentials.txt
Created February 19, 2021 02:00
cygwin essential packages
ca-certificates
curl
gcc
git
grep
gzip
less
make
nano
openssh
module.exports = {
messages: {
required: : "O campo '{field}' é obrigatório.",
string: "O campo '{field}' deve ser uma string.",
stringEmpty: "O campo '{field}' não deve estar vazio.",
stringMin: "O comprimento do campo '{field}' deve ser maior ou igual a {expected} caracteres.",
stringMax: "O comprimento do campo '{field}' deve ser menor ou igual a {expected} caracteres.",
stringLength: "O comprimento do campo '{field}' deve ter {expected} caracteres.",
stringPattern: "O campo '{field}' não corresponde ao padrão exigido.",
@mtcarvalho
mtcarvalho / Dockerfile
Last active September 26, 2019 12:37
Dockerfile for TensorFlow with Jupyter
# https://github.com/jupyter/docker-stacks/blob/master/tensorflow-notebook/Dockerfile
# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
ARG BASE_CONTAINER=jupyter/scipy-notebook
FROM $BASE_CONTAINER
LABEL maintainer="Jupyter Project <jupyter@googlegroups.com>"
# Install Tensorflow
@mtcarvalho
mtcarvalho / english2piglatintranslator.py
Created August 28, 2018 19:58
english to pig latin translator. will be improved later.
englishphrase = input("Write some phrase to translate it from english to pig latin: ").lower().strip()
englishwords = englishphrase.split()
piglatinphrase = []
for engword in englishwords:
pigword = []
if engword[0] in "aeiou":
pigword = engword + "yay"
@mtcarvalho
mtcarvalho / dummy_for.py
Created August 26, 2018 21:34
loops in python
# python script using a for loop, checking how many vowels some word or phrase has
word = input("Type some word to find out how many vowels and consonants it has: ").strip().lower()
vowels = 0
consonants = 0
for letter in word:
if letter.lower() in "aeiou":
vowels = vowels + 1
elif (letter == " "):
@mtcarvalho
mtcarvalho / manipulating_dictionaries.py
Created August 13, 2018 01:54
examples manipulating lists, tuples and dictionaries in python
""" Creating a dictionary """
students = {'Alice':25, 'Bob': 27, 'Charlie': 33, 'David': 21, 'Dan': 19, 'Emma': 19}
""" Adding an entry """
students['Frank'] = 22 # {'Alice': 25, 'Bob': 27, 'Charlie': 33, 'David': 21, 'Dan': 19, 'Emma': 19, 'Frank': 22}
""" Updating a value """
@mtcarvalho
mtcarvalho / bmi.py
Created August 3, 2018 21:56
body mass index (bmi) calculator in python
print("discover how healthy you are by checking your body mass index (bmi)")
print()
weight = input("type your weight (kg): ")
height = input("type your height (m): ")
bmi = float(weight) / (float(height) * float(height))
print("according to your bmi, {:.2f}, ".format(bmi), end="")
@mtcarvalho
mtcarvalho / 01_str_methods.py
Last active August 30, 2018 17:20
manipulating (global and local) variables, strings (with slicing and string methods) and lists in python
print("Hello".count("e")) # 1
print("Hello".count("el")) # 1
print("Peter".lower()) # peter
print("Peter".upper()) # PETER
print("peter parker".capitalize()) # Peter parker
print("peter parker".title()) # Peter Parker
print("peter parker".islower()) # True