Skip to content

Instantly share code, notes, and snippets.

import collections
import datetime
import logging
from goblin import properties
logger = logging.getLogger(__name__)
CARD_MAPPING = {'Cardinality.single': 'Cardinality.SINGLE',
@zhiboz
zhiboz / downloadAndWrite.sh
Created April 27, 2018 17:56 — forked from amcp/downloadAndWrite.sh
This groovy script loads the Enron email graph and performs a traversal for the shortest path between two nodes
#!/bin/bash
wget https://snap.stanford.edu/data/email-Enron.txt.gz
gunzip email-Enron.txt.gz
bin/gremlin.sh #and then :load enron.groovy
@zhiboz
zhiboz / first_debate_2016.R
Last active November 13, 2017 20:01 — forked from benmarwick/first_debate_2016.R
data science in R
library(tidyverse)
library(stringr)
# read in the transcript
# I simply copied the text from the page at
# https://www.washingtonpost.com/news/the-fix/wp/2016/09/26/the-first-trump-clinton-presidential-debate-transcript-annotated/
# and popped it into a txt file
xx <- scan("first_debate_2016.txt", "character")
@zhiboz
zhiboz / python-requests-postgrest-client.py
Last active November 13, 2017 20:02 — forked from davidthewatson/python-requests-postgrest-client.py
python-requests-postgrest-client
import requests
import requests_jwt
import json
# email and password auth through postgrest
resp = requests.post('http://localhost:3000/rpc/login', json={"email": "you@yours.com", "pass": "dog"})
print resp # <Response [200]>
# JWT token-based auth through postgrest using the returned token from above
auth = requests_jwt.JWTAuth(json.loads(resp.text)['token'])
#==========================================================#
# Visualizing Facebook networks with friend photos #
# Katya Ognyanova, www.kateto.net, @ognyanova #
#==========================================================#
# Find more details at http://bit.ly/fbgephi
#==========================================================#
#### Collect the data using the RFacebook package ####
@zhiboz
zhiboz / gist:dc8c4f9d4a0590cad41b2d0941b4ebfd
Created May 27, 2016 15:29 — forked from drorata/gist:146ce50807d16fd4a6aa
Minimal Working example of Elasticsearch scrolling using Python client
# Initialize the scroll
page = es.search(
index = 'yourIndex',
doc_type = 'yourType',
scroll = '2m',
search_type = 'scan',
size = 1000,
body = {
# Your query's body
})