This file contains 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 asyncio | |
import smtplib | |
import ssl | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
from socket import gaierror | |
import base64 | |
import datetime as dt | |
import imghdr | |
import json |
This file contains 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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
This file contains 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 inspect | |
from functools import partial, wraps | |
from typing import Union | |
from app import schemas | |
from app.db import database | |
from pydantic.main import ModelMetaclass | |
from shortuuid import uuid | |
# The following 2 functions parse raw results from the SQL queries |
This file contains 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
# docd.py | |
def doc(f): | |
with open("docs.txt") as d: | |
docfile = d.read() | |
# save old docstring | |
if f.__doc__: | |
prev_doc = f.__doc__ | |
f.__doc__ = prev_doc + "\n\n# docdoc\n" + docfile |
This file contains 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
-- walkthrough of: https://mystery.knightlab.com | |
-- | |
/* A crime has taken place and the detective needs | |
* your help. The detective gave you the crime | |
* scene report, but you somehow lost it. You | |
* vaguely remember that the crime was a murder | |
* that occurred sometime on Jan.15, 2018 and that | |
* it took place in SQL City. Start by retrieving | |
* the corresponding crime scene report from the | |
* police department’s database. */ |
This file contains 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
new_cols_nodrug = [c for c in df.columns.to_list() if c not in all_drug_cols] | |
new_cols = new_cols_nodrug.copy() | |
for i in range(len(drugs)): | |
new_cols.append(f"drug_{i}") | |
new_cols.append(f"pasi_inicial_{i}") | |
new_cols.append(f"tiempo_{i}") | |
new_cols.append(f"motivo_{i}") | |
This file contains 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 typing import Iterable | |
def get_repr(elem, l): | |
if len(str(elem)) > l: | |
return str(elem)[: l - 3] + "..." | |
return str(elem) |
This file contains 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
Non-user install because user site-packages disabled | |
Created temporary directory: /private/var/folders/gz/zzx2nwnj45x024zrqbkr0cm00000gn/T/pip-ephem-wheel-cache-6n511flg | |
Created temporary directory: /private/var/folders/gz/zzx2nwnj45x024zrqbkr0cm00000gn/T/pip-req-tracker-rb5j0ih0 | |
Initialized build tracking at /private/var/folders/gz/zzx2nwnj45x024zrqbkr0cm00000gn/T/pip-req-tracker-rb5j0ih0 | |
Created build tracker: /private/var/folders/gz/zzx2nwnj45x024zrqbkr0cm00000gn/T/pip-req-tracker-rb5j0ih0 | |
Entered build tracker: /private/var/folders/gz/zzx2nwnj45x024zrqbkr0cm00000gn/T/pip-req-tracker-rb5j0ih0 | |
Created temporary directory: /private/var/folders/gz/zzx2nwnj45x024zrqbkr0cm00000gn/T/pip-install-xiyr_889 | |
1 location(s) to search for versions of gensim: | |
* https://pypi.org/simple/gensim/ | |
Fetching project page and analyzing links: https://pypi.org/simple/gensim/ |
This file contains 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, { useState } from "react"; | |
import ReactDOM from "react-dom"; | |
// import "./App.css"; | |
class ClassExample extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { count: 0 }; | |
} |
This file contains 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, { useState, useEffect } from "react"; | |
import ReactDOM from "react-dom"; | |
// import "./App.css"; | |
class ExampleClass extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { count: 0 }; | |
} |