Skip to content

Instantly share code, notes, and snippets.

View eder-projetos-dev's full-sized avatar

Éder Luís Britto Garcia eder-projetos-dev

View GitHub Profile
@eder-projetos-dev
eder-projetos-dev / cotacao_btc_dolar_gist.py
Created March 3, 2023 14:17
Python - Cotação BTC em dólar com a API do CoinMarketCap
from requests import Request, Session
import json
import time
import webbrowser
import pprint
def getInfo (): # Function to get the info
url = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest' # Coinmarketcap API url
@eder-projetos-dev
eder-projetos-dev / README.md
Last active March 4, 2023 01:07
Python - Barcode generator

Barcode Generator in Python

Install python-barcode

pip install python-barcode

Test

#!/usr/bin/env python
@eder-projetos-dev
eder-projetos-dev / teste.html
Created May 14, 2023 15:04
JavaScript - Copiar para o Clipboard
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="data:," />
<title>Copy to Clipboard</title>
</head>
<body>
@eder-projetos-dev
eder-projetos-dev / simple_sign_in_and_sign_out.py
Created May 17, 2023 19:28 — forked from daGrevis/simple_sign_in_and_sign_out.py
Python - Simple sign in and sign out in Python's Flask
from flask import Flask, session, escape, request, redirect, url_for
from os import urandom
app = Flask(__name__)
app.debug = True
app.secret_key = urandom(24)
@app.route('/')
@eder-projetos-dev
eder-projetos-dev / gist:9684a93879cfc819b13a5f8c704436d2
Created June 1, 2023 13:40
CSS - Mudar a cor do radio button
<style>
input[type='radio'] {
accent-color: #232323;
}
</style>
<!-- HTML -->
<details open id="details_vermelho" class="collapse1">
<summary class="title">Vermelho</summary>
<div style="background-color: #e14747"><br></div>
<div>
<p>Lorem ipsum dolor, sit amet consectetur adipisicing elit.</p>
</div>
</details>
# Traditional approach
squares = []
for num in range(1, 11):
squares.append(num**2)
# List comprehension
squares = [num**2 for num in range(1, 11)]
# Traditional approach
point = (3, 7)
x = point[0]
y = point[1]
# Tuple unpacking
x, y = point
# Pro Tip: When unpacking tuples, you can use an asterisk (*) to capture multiple elements into a single variable.
# This is particularly useful when dealing with variable-length tuples.
# Traditional approach
file = open("data.txt", "r")
try:
data = file.read()
# Process the data
finally:
file.close()
# Context manager
with open("data.txt", "r") as file:
@eder-projetos-dev
eder-projetos-dev / gist:282d9f143caf43ec26e6a71e0e188b5b
Created June 3, 2023 16:54
Python - Context Manager / Database Connection
import sqlite3
with sqlite3.connect("mydb.db") as conn:
cursor = conn.cursor()
cursor.execute("SELECT * FROM users")
results = cursor.fetchall()