git checkout -b <branchname>
git add
git commit -m "description of changes"
| """ | |
| Usage: | |
| Make sure that redis is running on localhost (or adjust the url) | |
| Install uvicorn or some other asgi server https://asgi.readthedocs.io/en/latest/implementations.html | |
| pip install -u uvicorn | |
| Install dependencies |
| class SearchTree: | |
| def __init__(self, cargos: List[dict], trucks: List[dict]): | |
| self.cargo_nodes, self.truck_nodes = self.build_nodes(cargos, trucks, Node) | |
| self.tree = KdTree(self.truck_nodes) | |
| self.delivery_distance = { | |
| item['product']: geodesic( | |
| (item['origin_lat'], item['origin_lng']), | |
| (item['destination_lat'], item['destination_lng']) | |
| ) for item in cargos | |
| } |
| <rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0"> | |
| <channel> | |
| <title>G1 > Loterias</title> | |
| <link>http://g1.globo.com/loterias/index.html</link> | |
| <description> | |
| Veja no G1 Loterias os resultados dos últimos concursos da Mega-Sena, Dupla Sena, Loteria Federal, Loteca, Lotofacil, Lotogol, Lotomania, Quina e Timemania. | |
| </description> | |
| <language>pt-BR</language> | |
| <copyright>© Copyright Globo Comunicação e Participações S.A.</copyright> | |
| <atom:link href="http://pox.globo.com/rss/g1/loterias/" rel="self" type="application/rss+xml"/> |
| migrations.RunSQL(""" | |
| ALTER TABLE "campaigns_groupmember" | |
| ADD CONSTRAINT "campaigns_groupmember_parent_order_uniq" | |
| UNIQUE USING INDEX "campaigns_groupmember_parent_order_uniq" | |
| DEFERRABLE | |
| INITIALLY IMMEDIATE | |
| """), |
| seq_page_cost (floating point) | |
| Sets the planner's estimate of the cost of a disk page fetch that is part of a series of sequential fetches. The default is 1.0. This value can be overridden for tables and indexes in a particular tablespace by setting the tablespace parameter of the same name (see ALTER TABLESPACE). | |
| random_page_cost (floating point) | |
| Sets the planner's estimate of the cost of a non-sequentially-fetched disk page. The default is 4.0. This value can be overridden for tables and indexes in a particular tablespace by setting the tablespace parameter of the same name (see ALTER TABLESPACE). | |
| Reducing this value relative to seq_page_cost will cause the system to prefer index scans; raising it will make index scans look relatively more expensive. You can raise or lower both values together to change the importance of disk I/O costs relative to CPU costs, which are described by the following parameters. | |
| Random access to mechanical disk storage is normally much more expensive than four times sequential |
| import Adafruit_DHT | |
| import time | |
| isRunning = True | |
| while isRunning: | |
| try: | |
| humidity, temperature = Adafruit_DHT.read_retry(Adafruit_DHT.DHT11, 4) | |
| if humidity is not None and temperature is not None: | |
| print('Temp={0:0.1f}* Humidity={1:0.1f}%'.format(temperature, humidity)) | |
| else: |
| [].forEach.call($$("*"),function(a){ | |
| var color = (~~(Math.random()*(1<<24))).toString(16) | |
| a.style.outline="1px solid #"+color; | |
| var dom = document.createElement("div"); | |
| dom.setAttribute("style", "font-size: 10px; margin:5px; background: #"+color); | |
| dom.innerText = a.localName; | |
| a.appendChild(dom); | |
| }) |
| """ | |
| Example of setting up CORS with Bottle.py. | |
| """ | |
| from bottle import Bottle, request, response, run | |
| app = Bottle() | |
| @app.hook('after_request') | |
| def enable_cors(): | |
| """ |