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 theading import Thread | |
class StoppableThread(Thread): | |
"""A thread which can be stopped from thread reference.""" | |
do_run = True | |
def stop(self): | |
"""Stop this thread.""" | |
self.do_run = False |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
class PersonClass(object): | |
def __init__(self, name=None, cursor=None): | |
"""Constructor for PersonClass.""" | |
self.name = name | |
self.cursor = cursor | |
self.insert_sql = 'INSERT INTO person VALUES ?;' | |
async def create(self): | |
"""Persist the person to the 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
# I don't even know where to begin. |
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
var express = require('express'); | |
var app = express(); | |
// Create a route for the base endpoint | |
app.get('/', (req, res) => { | |
res.send('Hello World!'); | |
}); | |
// Run the server | |
app.listen(3000, () => null); |
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 flask import Flask | |
app = Flask(__name__) | |
# Create a route for the base endpoint | |
@app.route("/") | |
def hello(): | |
return "Hello World!" | |
# Run the server | |
app.run() |
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 json | |
import asyncio | |
from aiohttp import web, get | |
async def hello(request: web.Request): | |
print(request.headers) | |
return web.Response( | |
body=bytes(json.dumps(dict( | |
name='veggiecron-server', | |
author='Jacob Bridges', |
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 | |
from collections import Counter | |
SPEECH_TO_PROCESS = "Year End Press Conference -- (12-19-2014).txt" | |
# Open speech document | |
with open(SPEECH_TO_PROCESS, "r") as SPEECH_FILE: | |
# Read speech text into variable, converting any pesky unicode characters | |
speech = SPEECH_FILE.read().decode('utf8').encode("ascii", "ignore") |
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 | |
from collections import Counter | |
SPEECH_TO_PROCESS = "Year End Press Conference -- (12-19-2014).txt" | |
IGNORE_WORDS = ["a", "an", "the", "and", "that", "is", "are", "were", "be", "be", "being", "been", "have", "has", "had", "do", "does", "did", "not", "it", "they", "its", "aboard", "about", "above", "across", "after", "against", "along", "amid", "among", "anti", "around", "as", "at", "before", "behind", "below", "beneath", "beside", "besides", "between", "beyond", "but", "by", "concerning", "considering", "despite", "down", "during", "except", "excepting", "excluding", "following", "for", "from", "in", "inside", "into", "like", "minus", "near", "of", "off", "on", "onto", "opposite", "outside", "over", "past", "per", "plus", "regarding", "round", "save", "since", "than", "through", "to", "toward", "towards", "under", "underneath", "unlike", "until", "up", "upon", "versus", "via", "with", "within", "without"] | |
# Open speech document | |
with open(SPEECH_TO_PROCESS, "r") as SPEECH_FILE: | |