Skip to content

Instantly share code, notes, and snippets.

View rmondragon's full-sized avatar

Rolando Galindo rmondragon

View GitHub Profile
@rmondragon
rmondragon / JsonGsonToListOrMap.java
Created May 15, 2017 18:25
JSON to List or Map using GSON
import java.util.List;
import java.util.Map;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import javax.ws.rs.core.GenericType;
public class JsonGsonToListOrMap {
public static void main(String[] args) {
sudo mdutil -E /
@rmondragon
rmondragon / onebyaol.py
Created August 22, 2018 17:21
ONE by AOL Get Token
import json
import uuid
import requests
import jwt
import datetime
def get_jwt_token(client_id, secret):
millis = datetime.datetime.utcnow()
plus10min = millis + datetime.timedelta(minutes=10)
ISO3166_3to2 = {
'AFG': 'AF',
'ALA': 'AX',
'ALB': 'AL',
'DZA': 'DZ',
'ASM': 'AS',
'AND': 'AD',
'AGO': 'AO',
'AIA': 'AI',
'ATA': 'AQ',
@rmondragon
rmondragon / est_date.py
Created August 30, 2018 15:56
Get todays start date from in UTC for ET (EDT or EST)
date = "2018-08-30"
year, month, day = date.split('-')
utc = pytz.utc
eastern = timezone('US/Eastern')
# fmt = '%Y-%m-%d %H:%M:%S %Z%z' # returns 2018-08-29 20:00:00 EDT-0400
fmt = '%Y-%m-%dT%H:%M:%SZ'
utc_dt = datetime(year=int(year), month=int(month), day=int(day), hour=0, minute=0, second=0, tzinfo=utc)
loc_dt = utc_dt.astimezone(eastern)
start_date = loc_dt.strftime(fmt) #2018-08-29T20:00:00Z
utc_dt = datetime(year=int(year), month=int(month), day=int(day), hour=23, minute=59, second=59, tzinfo=utc)