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
""" | |
Machine Learning model to predict the genres of a movie from its summary | |
""" | |
import os | |
import pickle | |
from io import StringIO | |
from flask import Flask, request | |
from sklearn.preprocessing import MultiLabelBinarizer |
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 os | |
from flask.json import JSONEncoder | |
import datetime | |
class CustomJSONEncoder(JSONEncoder): | |
"Add support for serializing time" | |
def default(self, o): |
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
# coding: utf-8 | |
""" | |
a simple concurrent web server | |
socket -> bind -> listen -> accept -> loop | |
""" | |
import socket | |
import os | |
import time | |
import signal |
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
""" | |
Lispy: Scheme Interpreter in Python | |
Peter Norvig's lis.py studied here | |
http://norvig.com/lispy.html | |
The beauty of Scheme is that the full language only needs 5 keywords and 8 syntactic forms. | |
In comparison, Python has 33 keywords and 110 syntactic forms, | |
and Java has 50 keywords and 133 syntactic forms. |
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 re | |
import math | |
import operator | |
import logging | |
from collections import defaultdict, Counter | |
import numpy as np | |
class Tokenizer: | |
def __init__(self, stop_words, ): |
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 logging | |
import collections | |
import urllib.parse | |
from pprint import pprint | |
import aiohttp | |
import bs4 | |
class AsyncCrawler: |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#define STACK_MAX 256 | |
typedef enum | |
{ | |
OBJ_INT, | |
OBJ_PAIR | |
} ObjectType; |
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
#include <stdlib.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <math.h> | |
typedef struct { | |
char* key; | |
char* value; | |
} key_value_pair; |
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 time | |
import hashlib | |
import uuid | |
import random | |
from dataclasses import dataclass | |
from typing import List | |
@dataclass | |
class Node: | |
uid: str |
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
INTEGER | |
BOOLEAN | |
TEXT | |
FLOAT | |
DOUBLE | |
CHARACTER(num_chars) | |
VARCHAR(num_chars) | |
DATE | |
DATETIME | |
BLOB |