This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useState } from 'react' | |
export const AppContext = React.createContext() | |
export const WS = new WebSocket("ws://localhost:8000/subscribe=accounts,funds,orders,quotes&refresh=2") | |
export const AppContextProvider = (props) => { | |
let [loading, setLoading] = useState(true) | |
let [accounts, setAccounts] = useState({}) | |
let [funds, setFunds] = useState({}) | |
let [orders, setOrders] = useState([]) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import scrapy | |
from scrapy import Request | |
from scrapy import signals | |
class G1Spider(scrapy.Spider): | |
name = 'g1' | |
allowed_domains = ['g1.globo.com'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from Construtor import * | |
def usuario_seleciona_uma_opcao(): | |
print('*'*23 + '*'*10 + ' CONTROLADOR DE VOO - IFSP ' + '*'*22 + '\n'*2) | |
NU = input('Escolha uma opção desejada:\n 1) Listar o número de aviões\n 2) Autorizar a decolagem do primeiro avião\n 3) Adicionar avião na fila de espera\n 4) Listar todos os aviões na fila de espera\n 5) Listar todas as características do primeiro avião\n 6) Sair\n Sua Opção: ') | |
return NU | |
if __name__ == "__main__": | |
opcao = usuario_seleciona_uma_opcao() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Controlador(object): | |
def __init__(self): | |
self.fila_avioes = {'tam': 'rjo-spo', 'azul': 'rjo-miami', 'gol':'rjo-bsa'} | |
self.num_avioes = len(fila_avioes) | |
#a)listar os números de avioes esperando para decolar: | |
def listar(self) | |
for chave in fila_avioes: | |
print (self.num_avioes) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
import re | |
from os import listdir | |
from os.path import isfile, join | |
def main(): | |
folder = './logs' | |
onlyfiles = [f for f in listdir(folder) if isfile(join(folder, f))] | |
log_files = filter( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import scrapy | |
from scrapy import Request | |
from scrapy.linkextractors import LinkExtractor | |
from keywords import ocean_keywords as keywords | |
class BBCSpider(scrapy.Spider): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lista1 = [10, 20, 30, 40] | |
lista2 = [10, 30, 100, 110, 44] | |
resultado = set(lista1) - set(lista2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# models.py | |
class User(Document): | |
image = ImageField() | |
# views.py | |
image = open('/path/to/your/file', 'rb') | |
user = User() | |
user.image.put(image, content_type = 'image/jpeg') | |
user.save() |
NewerOlder