Skip to content

Instantly share code, notes, and snippets.

@Wavewash
Wavewash / Test
Created July 19, 2012 17:44
Test Gist.IO
# Gist.IO make this pretty
pretty please.
@Wavewash
Wavewash / DataMunger.py
Last active August 29, 2015 14:01
Convert a Quickbase csv file to a JSON file that is consumable by Solr. This python file was meant to be run as a command line utility taking in as arguments the input csv file and output file. To import the produced json file into solr I found success with the post.jar provided with the examples in solr. So an example import command would look …
__author__ = 'mo kakwan'
import sys
import csv
import json
import time
if len(sys.argv) <= 1:
print("USAGE: input.csv output.json")
sys.exit(0)
@Wavewash
Wavewash / gist:70532f2cc945a830627e
Last active June 19, 2016 15:19
Enabling CORS (Cross-Origin Resource Sharing) on the example solr Jetty server
In the example solr project when you start it up by calling the following line:
java -jar start
You are starting a Jetty server on your local machine that's going to serve the solr results. This server is not able to do CORS (Cross Origin Resource Sharing). Which means that if you tried to do an AJAX call from a webpage of a different origin than the server itself you would be denied a response.
To fix this you first need to get the apropriate jars to allow for cross-domain resource sharing.
I used the following jar:
http://repo1.maven.org/maven2/org/eclipse/jetty/jetty-servlets/8.1.10.v20130312/
@Wavewash
Wavewash / Data Clenser for Year Strings to Lists
Created June 11, 2014 13:09
This was used to cleanse data input by various users for years in a record system. The years being input by different people with different methods all had different formats. Some were just plain incorrect. To reduce the effort by the data cleansing team to unify the year format. This high level parser was written to catch most obvious date form…
__author__ = 'mkakwan'
import sys
def clense(row, headers):
i=0
clensedkey = "year_cleansed"
newAnnualReportsClensedValue = None;
for key in row: