Skip to content

Instantly share code, notes, and snippets.

View joshgeller's full-sized avatar
👽
I want to believe.

Josh Geller joshgeller

👽
I want to believe.
View GitHub Profile
@joshgeller
joshgeller / importcsv.py
Last active August 29, 2015 14:04
Add contents of specified columns in .csv file to a list of dictionaries
import csv
def import_csv(filename=None, import_all_columns=False, columns_to_import=None, remove_duplicates=False):
"""
Add contents of specified columns in .csv file to a list of dictionaries.
:param filename: string
:param import_all_columns: bool
:param columns_to_import: list
@joshgeller
joshgeller / today_to_midnight_utc.py
Created May 2, 2018 21:46
Convert local date to midnight UTC timestamp
import pytz
from datetime import date, datetime, time
def today_to_midnight_utc(local_tz='UTC'):
"""
Returns today's date (local timezone) as a midnight UTC timestamp.
e.g. If date is 04/20/18, and server timezone is America/Los_Angeles:
today_to_midnight_utc(local_tz='America/Los_Angeles')
>> 1524182400
@joshgeller
joshgeller / cities.json
Last active March 19, 2023 01:19 — forked from Miserlou/cities.json
1000 Largest US Cities By Population With Geographic Coordinates and Timezone, in JSON
[
{
"city": "New York",
"growth_from_2000_to_2013": "4.80%",
"latitude": 40.7127837,
"longitude": -74.0059413,
"population": 8405837,
"rank": 1,
"state": "New York",
"timezone": "America/New_York"