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
@split | |
@login_required | |
def hello(): | |
return render_template('hello.html') | |
@hello.for_mimetype("application/json") | |
@login_required | |
def hello(): | |
return jsonify({"hello":"flask"}) |
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 requests | |
#http://docs.python-requests.org/en/latest/user/quickstart/#post-a-multipart-encoded-file | |
url = "http://localhost:5000/" | |
fin = open('simple_table.pdf', 'rb') | |
files = {'file': fin} | |
try: | |
r = requests.post(url, files=files) | |
print r.text |
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
namespace Discretization | |
// Recursive minimal entropy partitioning, | |
// based on Fayyad & Irani 1993. | |
// See the following article, section 3.3, | |
// for a description of the algorithm: | |
// http://www.math.unipd.it/~dulli/corso04/disc.pdf | |
// Note: this can certainly be optimized. | |
module MDL = |
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 celery import Celery | |
from celery.signals import after_task_publish,task_success,task_prerun,task_postrun | |
# first argument, current module | |
app = Celery('tasks') | |
app.config_from_object('celeryconfig') | |
# To instantiate celery and import this module | |
# do: celery -A task worker --loglevel=info | |
# after, once celery is running, instantiate a python console: |
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/env python | |
# encoding: utf-8 | |
import imp | |
import os | |
import pdb | |
import pip | |
import readline | |
from pip.commands.search import SearchCommand | |
import sys |
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
#!/bin/bash | |
# Runs airflow-dags tests. | |
# Set Nose defaults if no arguments are passed from CLI. | |
CWD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
NOSE_ARGS=$@ | |
if [ -z "$NOSE_ARGS" ]; then | |
NOSE_ARGS=" \ | |
--with-coverage \ |
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 | |
import unittest | |
from airflow.models import DagBag | |
class TestDags(unittest.TestCase): | |
""" | |
Generic tests that all DAGs in the repository should be able to pass. | |
""" |
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
rust-server: | |
image: didstopia/rust-server | |
restart: always | |
mem_limit: 15g | |
ports: | |
- "28015:28015" | |
- "28015:28015/udp" | |
- "28016:28016" | |
- "80:8080" | |
volumes: |
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
#!/bin/bash | |
#This script creates 1 master, 2 slaves and 3 sentinels services in docker swarm. | |
docker network create \ | |
--driver overlay \ | |
testes_network | |
SWARM_MASTER=192.168.205.125 | |
#Master |
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
## Gist originally developed by @craffel and improved by @ljhuang2017 | |
import matplotlib.pyplot as plt | |
import numpy as np | |
def draw_neural_net(ax, left, right, bottom, top, layer_sizes, coefs_, intercepts_, n_iter_, loss_): | |
''' | |
Draw a neural network cartoon using matplotilb. | |
:usage: |
OlderNewer