Skip to content

Instantly share code, notes, and snippets.

View amaurs's full-sized avatar

Amaury Gutiérrez amaurs

View GitHub Profile
@amaurs
amaurs / mandelbrot.py
Last active August 13, 2020 19:33
Flask service to create mandelbrot set tiling.
from flask import Flask, send_file
import math
from PIL import Image
import numpy as np
import os.path
from io import BytesIO
from numba import jit
app = Flask(__name__)
@amaurs
amaurs / app.js
Last active June 21, 2018 21:00
App that lets you connect to a SQL SERVER database with tedious and server the query through express.
if (process.env.NODE_ENV !== 'production') {
require('dotenv').load();
}
var Connection = require('tedious').Connection;
var Request = require('tedious').Request;
var fs = require('fs');
var query = fs.readFileSync("query.sql", "utf8");
var port = 3000;
var config = {
userName: process.env.USER_NAME,
@amaurs
amaurs / package.json
Created June 21, 2018 18:09
package.json
{
"name": "literature",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
@amaurs
amaurs / exhibit_a.py
Last active June 20, 2020 01:37
exhibit a
class A:
some_value = {}
class B(A):
def modify_value(self):
self.some_value.update({"some_value": "b"})
class C(A):
class A:
def __init__(self):
self.some_value = {}
class B(A):
def modify_value(self):
self.some_value.update({"some_value": "b"})
class C(A):
from typing import List
import markovify
import argparse
# Example:
# python sentence_generator.py text_1.txt text_2.txt text_2.txt --state-size 2
# python sentence_generator.py text_1.txt text_2.txt
def main(filenames: List[str], state_size: int) -> str:
text_model = markovify.combine([load_text_model(filename, state_size=state_size) for filename in filenames])