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 | |
import httplib | |
import pymongo | |
from time import sleep | |
url = 'http://citibikenyc.com/stations/json' | |
connection = pymongo.Connection() | |
db = connection['citibike'] | |
collection = db['station_status'] |
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
# Python 3.4 | |
import requests | |
import bs4 | |
def get_stock_price(name): | |
url = "https://www.google.com/finance" | |
data = requests.get(url, params={'q': name}) | |
bs = bs4.BeautifulSoup(data.text) | |
div_price = bs.find(attrs={"id": "price-panel"}) |
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
#!/bin/bash | |
set -eu | |
shopt -s nullglob | |
readonly base_dir=/var/lib/docker/registry | |
readonly output_dir=$(mktemp -d -t trace-images-XXXX) | |
readonly jq=/usr/bin/jq | |
readonly repository_dir=$base_dir/repositories |
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
#!/bin/bash | |
function hacstest { | |
name=$1 | |
result=$2 | |
expected=$3 | |
if [ $result = $expected ] | |
then | |
echo -n "." | |
else |
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
(ns framework | |
(:require [reagent.core :as reagent])) | |
(def isClient (not (nil? (try (.-document js/window) | |
(catch js/Object e nil))))) | |
(def rflush reagent/flush) | |
(defn add-test-div [name] | |
(let [doc js/document | |
body (.-body js/document) |
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
; HTTP Client for OpenHDS-REST | |
(ns ohds.client | |
(:require [clojure.edn :as edn] | |
[clojure.tools.logging :as log] | |
[org.httpkit.client :as http] | |
[clojure.data.json :as json] | |
[schema.core :as s]) | |
(:import (java.time LocalDateTime))) |
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
(ns interactive) | |
(defn my-fancy-function | |
[x y z] | |
(* x y z)) | |
(comment | |
(= 1 (my-fancy-function 1 1 1)) ; eval here, move to a test ns when you're done and want a regression suite | |
) |
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 itertools as it | |
import random | |
def cards(n, t): | |
nt = n*t | |
images = range(nt) | |
return [[j for j in images[i:i + t]] for i in range(0, n*t, t)] | |
def edges(cards, link_count): | |
ct = min(len(cards), link_count) # we can't have more edges than cards for prop4 |
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 | |
filename = '/full/path/tofile/' | |
with open(filename, 'rb') as csvfile: | |
reader = csv.reader(csvfile, delimiter=' ', quotechar='|') | |
result = [row for row in reader if 'N/A' in reader] | |
print result |
OlderNewer