Skip to content

Instantly share code, notes, and snippets.

View ReedJessen's full-sized avatar

Reed Jessen ReedJessen

View GitHub Profile
@ReedJessen
ReedJessen / gist:5abb06f78c045573d93c7c570e887e4b
Created April 9, 2019 17:44 — forked from jonperron/gist:733c3ead188f72f0a8a6f39e3d89295d
Serve pandas dataframe as csv with Django
from django.http import HttpResponse
import pandas as pd
def foo():
your_dataframe = pd.Dataframe()
response = HttpResponse(content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename=filename.csv'
results.to_csv(path_or_buf=response,sep=';',float_format='%.2f',index=False,decimal=",")
// Visit https://www.reddit.com/subreddits/ and run the following in console (browser dev tools)
// Wait until all the buttons have visibly toggled, refresh page to confirm.
$('.fancy-toggle-button .remove').each(function(i, elem) { setTimeout(function(){ $(elem).trigger('click'); }, i*500) });
Open up browser console, for Chrome, hit F12 and copy-paste and enter this
$("a").filter(function(index){return $(this).text()==="unsave"}).click();setTimeout(function(){location.reload();},500);
Repeat until all items are unsaved.
Verifying my Blockstack ID is secured with the address 1j7jdHTvQFD3Lq9PywG43oRRg1mYZbkee https://explorer.blockstack.org/address/1j7jdHTvQFD3Lq9PywG43oRRg1mYZbkee
@ReedJessen
ReedJessen / Neo4jIPStreetRun.md
Last active January 6, 2017 00:23
Runtime for building an Neo4j graph from IP Street Patent Data
from neo4j_writer import Neo4jWriter
from entity_models import Person, Patent, Company
from IPStreet import client, query


if __name__ == '__main__':
@ReedJessen
ReedJessen / NotRonysPatents.md
Created December 30, 2016 01:30
Query what patent's Rony Abovitz is not an inventor on
MATCH (a:Person)-[r:Invented]->(b:Patent)
MATCH (u:Person {full_name:'Abovitz, Rony'})
WHERE  not (u)-[:Invented]-(b) 
RETURN r
@ReedJessen
ReedJessen / HowManyPatents.md
Created December 30, 2016 01:25
Query to determine how many Patents are in the dataset
MATCH (n:Patent) RETURN count(n)
@ReedJessen
ReedJessen / SearchAbovitz.md
Created December 30, 2016 01:12
Get all the patents invented by Rony Abovitz
MATCH (a:Person {full_name: 'Abovitz, Rony'}) -[r]-> (b:Patent)
RETURN r
MATCH(a:Person {full_name: "Jon Doe"})
MATCH(b:Patent {grant_number: "7477713"}) 
MERGE(a)-[:Invented {priority_date:"2004-03-02"}]->(b)
@ReedJessen
ReedJessen / WriteRelationships.md
Created December 30, 2016 00:51
Methods for writing relationships between two nodes in Neo4j
class Neo4jWriter():
    def __init__(self):
        config = configparser.ConfigParser()
        config.read('config.ini')

        user_name = config.get('neo4j credentials', 'user_name')
        password = config.get('neo4j credentials', 'password')