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.
@ReedJessen
ReedJessen / csv_splitter.py
Last active August 19, 2016 19:40 — forked from jrivero/csv_splitter.py
A Python 3 CSV splitter
import os
def split(filehandler, delimiter=',', row_limit=10000,
output_name_template='output_%s.csv', output_path='.', keep_headers=True):
"""
Splits a CSV file into multiple pieces.
A quick bastardization of the Python CSV library.
Arguments: