Skip to content

Instantly share code, notes, and snippets.

View coreyhermanson's full-sized avatar

Corey Hermanson coreyhermanson

  • Dallas, TX
View GitHub Profile
@coreyhermanson
coreyhermanson / bp_twitterSentiment.py
Last active December 13, 2017 20:13
BrightPlanet API: Return docs and Sentiment Measures w/ VADER for Tweets
#!/usr/bin/env python
"""
This script returns documents from the BrightPlanet REST API. Input is a text file with a list of queries.
Output is a CSV file with your desired fields for each document. Default time period is everything until present.
Requires 'requests' module. To install via cmd, enter: python -m pip install requests
"""
import requests
import csv
@coreyhermanson
coreyhermanson / gist:85defceac4e5cd6548aef7e32ed89584
Created November 27, 2017 17:01
BrightPlanet Harvest API: Create RSS harvests from a spreadsheet of sources
import requests
import csv
input_file = r'YOUR_FULL_FILEPATH_HERE'
var_scheduled = "RECURRING"
var_initial_delay = 1.0 # float
var_time_between_scheduled_events = 12.0 # float
var_max_depth = 1
var_depth_external = 0
var_max_docsize = -1
@coreyhermanson
coreyhermanson / excelthings.md
Last active May 31, 2017 14:37
Random Excel functions

Nested "If value in list" function

=IF(SUMPRODUCT(--(B1={1,11,21,31}))>0,1,
IF(SUMPRODUCT(--(B1={2,22,32,12}))>0,2,
IF(SUMPRODUCT(--(B1={3,13,23,33}))>0,3,
IF(SUMPRODUCT(--(B1={4,14,24,34}))>0,4,
IF(SUMPRODUCT(--(B1={5,15,25,35}))>0,5,
IF(SUMPRODUCT(--(B1={6,16,26,36}))>0,6,
IF(SUMPRODUCT(--(B1={7,17,27,37}))>0,7,
@coreyhermanson
coreyhermanson / normalize_company.py
Created May 10, 2017 15:04
Strip company indicators from company terms
#!/usr/bin/env python
import pyperclip
import re
from list_clipboard_manipulations import list_to_clipboard
delete_counter = 0
good_list = list()
sort_alpha = False

Web Development CodeBook

Text Formatting

  • <strong> tag is preferred to <b> tag for BOLD
  • <em> tag is preferred to <i> tag for ITALICS
  • <ins> tag is preferred to <u> tag for UNDERLINES
  • sup for superscript
  • sub for subscript
  • del for strikethrough text
@coreyhermanson
coreyhermanson / deepweb_examples.md
Created April 4, 2017 17:47
BrightPlanet Harvest API: Deep Web Project Examples

BrightPlanet Harvest API: Deep Web harvest examples

One-Time and Scheduled harvest examples

  1. Unscheduled: Deep Web harvest will execute immediately (no delay parameter), and run once (scheduleType="ONCE" and no interval parameter)
 {
  "id": "string",
  "harvestEventType": "DEEP",
@coreyhermanson
coreyhermanson / bp_twitterharvest
Last active March 22, 2017 19:02
Harvest API - Twitter Harvest
import requests
infile = r'C:\Users\Account\PythonFiles\generic_infile.txt' # full path to any file inside quotes
# Harvest Event Variables
api_key = "123abc" # STRING - 1 API key per Harvest API schema
searchable_items_per_event = 100 # INT - max queries OR max screenNames
name_of_event = "NewYork_Politics" # STRING - Program will pre-pend "TW_" and add "_#" to the end
filterQuery = None # STRING - ex: "nuclear AND (war OR energy)"
event_tags = ["source_Politics", "New York"] # LIST
{
"id": "string",
"harvestEventType": "TWITTER",
"scheduleType": "ONCE",
"name": "TW_APItest_manual_2",
"twitterHarvestParameters": {
"screenNames": [
"deadspin", "pfrumors"
],
@coreyhermanson
coreyhermanson / python_codebook.md
Last active June 9, 2021 12:06
Python CodeBook