This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- first query all the users | |
| WITH offsets AS (SELECT a.*, | |
| EXTRACT(hour FROM ptn.utc_offset) AS utc_offset | |
| FROM bootcamp.attendees a | |
| JOIN pg_timezone_names ptn ON a.timezone = ptn.name | |
| WHERE a.bootcamp_version = 3 | |
| AND a.timezone IS NOT NULL | |
| AND a.content_delivery = 'Live'::text | |
| ), | |
| -- then aggregate the users by track and offset, we want matching timezones to fill up first |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| ''' | |
| Create an indexed tabix file from a Pandas dataframe | |
| via "pure" Python (i.e., no subprocess) | |
| ''' | |
| import os | |
| import io | |
| import pandas as pd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def speak(num: Int, printZero: Boolean = true): String = { | |
| if (num < 0) s"negative ${speak(-num)}" | |
| else if (num >= 1000000000) s"${speak(num / 1000000000)} billion ${speak(num % 1000000000, false)}" | |
| else if (num >= 1000000) s"${speak(num / 1000000)} million ${speak(num % 1000000, false)}" | |
| else if (num >= 1000) s"${speak(num / 1000)} thousand ${speak(num % 1000, false)}" | |
| else if (num >= 100) s"${speak(num / 100)} hundred ${speak(num % 100, false)}" | |
| else if (num >= 20) (num/10) match { | |
| case 2 => s"twenty ${speak(num % 10, false)}" | |
| case 3 => s"thirty ${speak(num % 10, false)}" | |
| case 5 => s"fifty ${speak(num % 10, false)}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import yaml | |
| from yaml.constructor import ConstructorError | |
| try: | |
| from yaml import CLoader as Loader | |
| except ImportError: | |
| from yaml import Loader | |
| def no_duplicates_constructor(loader, node, deep=False): |