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
# Basic key operators to query the JSON objects : | |
# #> : Get the JSON object at that path (if you need to do something fancy) | |
# -> : Get the JSON object at that path (if you don't) | |
# ->> : Get the JSON object at that path as text | |
# {obj, n} : Get the nth item in that object | |
# https://www.postgresql.org/docs/9.4/functions-json.html#FUNCTIONS-JSONB-OP-TABLE | |
# Date | |
# date before today |
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 socket | |
for pings in range(10): | |
client_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
client_socket.settimeout(1.0) | |
message = b'test' | |
addr = ("127.0.0.1", 12000) | |
start = time.time() |
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 SPARQLWrapper import SPARQLWrapper, JSON | |
import html, datetime, os, json, glob, time | |
def send_sparql_query(q, timeout=None, sleep=0): | |
time.sleep(sleep) | |
try: | |
sparql = SPARQLWrapper("http://dbpedia.org/sparql") | |
sparql.setReturnFormat(JSON) | |
if timeout: sparql.setTimeout(timeout) | |
sparql.setQuery(q) |
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 fractions import Fraction | |
import music21 | |
import glob | |
# remove leading / trailing whitespace | |
music21.defaults.ticksAtStart = 0 | |
notes = set([12*j + i for i in [0,2,4,5,7,9,11] for j in [0,1,2,3,4,5,6,7,8,9,10] ]) | |
def constrain_pitch(val): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file has been truncated, but you can view the full file.
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
START note_48_duration_240 note_76_duration_360 wait_240 note_55_duration_240 wait_120 note_72_duration_120 wait_120 note_67_duration_960 note_64_duration_960 note_60_duration_960 wait_240 note_55_duration_228 wait_240 note_55_duration_228 wait_240 note_55_duration_228 wait_240 note_60_duration_240 note_64_duration_240 note_69_duration_480 wait_240 note_55_duration_240 wait_240 note_71_duration_1440 note_65_duration_1440 note_62_duration_1440 wait_240 note_55_duration_228 wait_240 note_55_duration_228 wait_240 note_55_duration_228 wait_240 note_57_duration_240 wait_240 note_55_duration_240 wait_240 note_60_duration_240 note_64_duration_240 note_72_duration_480 wait_240 note_55_duration_240 wait_240 note_74_duration_360 note_65_duration_360 note_59_duration_1440 wait_240 note_55_duration_480 wait_120 note_76_duration_120 note_67_duration_120 wait_120 note_69_duration_960 note_77_duration_960 wait_240 note_55_duration_228 wait_240 note_55_duration_228 wait_240 note_55_duration_480 wait_240 note_67_duration_240 |
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 SPARQLWrapper import SPARQLWrapper, JSON | |
from collections import defaultdict | |
from bs4 import BeautifulSoup | |
import numpy as np | |
import json, os, glob, subprocess, string | |
import nltk, codecs, re, shutil, sys | |
################################################## | |
# Wrapper to find nested location of stored data # | |
################################################## |
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
%matplotlib inline | |
from math import cos, sin, sqrt, pi | |
import numpy as np | |
import matplotlib.pyplot as plt | |
# golden angle definition | |
ga = 360/((1+sqrt(5))/2)**2 | |
# initialize random array | |
a = np.zeros((1000, 2)) |
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
{0: 'tench, Tinca tinca', | |
1: 'goldfish, Carassius auratus', | |
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias', | |
3: 'tiger shark, Galeocerdo cuvieri', | |
4: 'hammerhead, hammerhead shark', | |
5: 'electric ray, crampfish, numbfish, torpedo', | |
6: 'stingray', | |
7: 'cock', | |
8: 'hen', | |
9: 'ostrich, Struthio camelus', |
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 itertools | |
import argparse | |
import MySQLdb | |
import json | |
import glob | |
import os | |
# for usage run `python ingest_epo.py -h` | |
defaults = { |
NewerOlder