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 urllib.request import urlopen | |
from urllib.error import HTTPError | |
from concurrent.futures import ThreadPoolExecutor, as_completed | |
class HttpError(Exception): | |
def __init__(self, url: str, code: int) -> None: | |
self.url = url | |
self.code = code |
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
#!/usr/bin/python3 | |
import sys | |
import asyncio | |
import greenlet | |
class AsyncIoGreenlet(greenlet.greenlet): | |
def __init__(self, driver, fn): | |
greenlet.greenlet.__init__(self, fn, driver) | |
self.driver = driver |
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
# Replace <sentry_key>, <sentry-url> and <project-id> to formulate your CURL request. Don't forget to add a trailing slash to URL otherwise you'll get wierd CSRF errors! | |
curl -X POST --data '{ "exception": [{ "type": "$ErrorMessage"}] }' -H 'Content-Type: application/json' -H "X-Sentry-Auth: Sentry sentry_version=7, sentry_key=<sentry_key>, sentry_client=raven-bash/0.1" https://<sentry-url>/api/<project-id>/store/ |
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
func ReadGzFile(filename string) ([]byte, error) { | |
fi, err := os.Open(filename) | |
if err != nil { | |
return nil, err | |
} | |
defer fi.Close() | |
fz, err := gzip.NewReader(fi) | |
if err != nil { | |
return nil, err |
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 sqlalchemy.orm import sessionmaker, relationship, aliased | |
from sqlalchemy import cast, Integer, Text, Column, ForeignKey, literal, null | |
from sqlalchemy.sql import column, label | |
class Catalog(Base): | |
__tablename__ = 'catalog' | |
id = Column(String, primary_key=True) | |
parentid = Column(String, ForeignKey('catalog.id')) | |
name = Column(String) | |
parent = relationship("Catalog", remote_side=[id]) |
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
/* Simple Browser Sample | |
* Put this file (browser.h) and browser.cpp, browser.pro in one folder. | |
* Use Qt Creator with Qt 5 to compile the project. | |
* | |
* Content of browser.cpp | |
* | |
#include "browser.h" | |
int main(int argc, char** argv) { | |
QApplication app(argc, argv); |