This file contains hidden or 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
# start the mongodb with the CLI command "mongod" | |
# you may get an error that the data path folder doesn't exist | |
# use mongod --dbpath /usr/local/mongodb-data to set the new directory for your data. dir must exist before command can be run | |
from pymongo import MongoClient | |
client = MongoClient() | |
db = client['test-database'] | |
# create a collection called posts |
This file contains hidden or 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 ubuntu:18.04 | |
RUN apt-get update | |
RUN apt-get install wget -y | |
RUN wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && \ | |
dpkg -i packages-microsoft-prod.deb | |
RUN apt-get install -y apt-transport-https && \ | |
apt-get update && \ |
This file contains hidden or 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 csv | |
import json | |
def make_adjacency_list(adj_list): | |
graph_list = [] | |
people = {} | |
for person in adj_list: | |
for k,v in person[1].items(): | |
person_id = person[0].keys()[0] | |
graph_list.append((person_id, k)) |
This file contains hidden or 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 bs4 import BeautifulSoup as bs | |
import spacy | |
def hash_text(text, digits=8): | |
return hash(text) % (10 ** digits) | |
def make_edge_dict(unique_edges): | |
edge_dict = {} | |
for edge in unique_edges: | |
try: |
This file contains hidden or 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 | |
articles = [] | |
with open('people.json', 'rb') as f: | |
for item in f: | |
articles.append(json.loads(item)) |
This file contains hidden or 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 multiprocessing import dummy | |
import requests | |
import pymongo | |
import time | |
# install mongo db via url below | |
# https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/ | |
mc = pymongo.MongoClient() | |
db = mc['db_name_here'] | |
items = db['collection_name_here'] |
This file contains hidden or 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
def valid_word? word | |
letters = { | |
'e' => 12, | |
'a' => 9, | |
'i' => 9, | |
'o' => 8, | |
'n' => 6, | |
'r' => 6, | |
't' => 6, | |
'l' => 4, |
This file contains hidden or 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
<div> | |
<form className="ui-filterable" id="searchbar"> | |
<input id="inset-autocomplete-input" data-type="search" placeholder="Search foods..."></input> | |
</form> | |
<ul data-role="listview" data-inset="true" data-filter="true" data-filter-reveal="true" data-input="#inset-autocomplete-input"> | |
{Object.keys(this.state.foods).forEach((food) => { | |
return ( | |
<li><a href="#">food</a></li> | |
); | |
})} |
This file contains hidden or 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
<div> | |
<form className="ui-filterable" id="searchbar"> | |
<input id="inset-autocomplete-input" data-type="search" placeholder="Search foods..."></input> | |
</form> | |
<ul data-role="listview" data-inset="true" data-filter="true" data-filter-reveal="true" data-input="#inset-autocomplete-input"> | |
{Object.keys(this.state.foods).forEach((food) => { | |
return ( | |
<li><a href="#">food</a></li> | |
); | |
})} |
This file contains hidden or 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
<div> | |
<form className="ui-filterable" id="searchbar"> | |
<input id="inset-autocomplete-input" data-type="search" placeholder="Search foods..."></input> | |
</form> | |
<ul data-role="listview" data-inset="true" data-filter="true" data-filter-reveal="true" data-input="#inset-autocomplete-input"> | |
{Object.keys(this.state.foods).forEach((food) => { | |
return ( | |
<li><a href="#">food</a></li> | |
); | |
})} |
NewerOlder