CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 06:04:42 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
etag: W/"1b2a2aa0608b4149fd8ff42decd13a78"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com github.githubassets.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com wss://alive-staging.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com marketplace-screenshots.githubusercontent.com/ copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=ejTwJMRXmI0HOJFayU9JzBjMhVO9xc4oguN6KdMq6Tiu09iVs81X9x%2FtXqQWxpwIA8C5uW0%2B0bpwdMXYQkyBAh48fT63F8lIEewphmnwX9hhGnK4rdl0MGMPlQnskRjqIqMfmdsO%2Fymw08wjLhdkNAwuLAXPemXeqYw5U6B%2Bs3syow6RBaXD6Oll87C34UcN%2BXUeZQO%2B3z1m72rvHYAVRaViupRZ7%2FVjsrui%2BbhHPuQEJGKjsys5u%2Fa%2F5fIWBU%2BYZjAFjCH0TUYOCWq2gFTpgw%3D%3D--ns3K3dLnZp8C34xp--ljK%2Bi8M90XZwZUapYbNP3A%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.1286240179.1760162682; Path=/; Domain=github.com; Expires=Sun, 11 Oct 2026 06:04:42 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Sun, 11 Oct 2026 06:04:42 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: C0BC:3B926C:351ED9:4B3668:68E9F37A
meeting_time.py · GitHub
Show Gist options
Save mnot/639ad9dd7d5577cbcc5b12c2bf9e450a to your computer and use it in GitHub Desktop.
{{ message }}
Instantly share code, notes, and snippets.
Last active
October 6, 2022 06:56
-
Star
0
(0)
You must be signed in to star a gist -
Fork
0
(0)
You must be signed in to fork a gist
-
Save mnot/639ad9dd7d5577cbcc5b12c2bf9e450a to your computer and use it in GitHub Desktop.
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
from collections import defaultdict | |
from datetime import datetime | |
import csv | |
import sys | |
__doc__ = """ | |
This is a script that uses CSV input data (for example, collected by a Google Form) to find the acceptable times for a meeting. | |
The CSV columns are: | |
1. Timestamp (often collected by online forms; ignored) | |
2. Name | |
3. Timezone (from the table below) | |
4. When is the earliest time you can start work in that timezone? This is not when you start your working day; list the earliest you could wake up for and still be functional in the meeting. | |
5. When is the latest time you can meet until in that timezone? Again, this is not when your workday ends, but how late you can stay up before you won't be able to effectively participate. | |
""" | |
# timezone: (northern_summer_offset, northern_winter_offset, timeanddate_id) | |
# source: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones | |
# and: https://dev.timeanddate.com/docs/available-locations | |
tzlookup = { | |
"Europe/London": (1, 0, 136), | |
"Europe/Berlin": (2, 1, 37), | |
"Europe/Helsinki": (3, 2, 101), | |
"Asia/Kolkata": (5.5, 5.5, 44), | |
"Asia/Beijing": (8, 8, 33), | |
"Asia/Tokyo": (9, 9, 248), | |
"Australia/Melbourne": (10, 11, 152), | |
"Pacific/Auckland": (12, 13, 22), | |
"Pacific/Honolulu": (-10, -10, 103), | |
"America/Los Angeles": (-7, -8, 137), | |
"America/Denver": (-6, -7, 75), | |
"America/Chicago": (-5, -6, 64), | |
"America/New York": (-4, -5, 179), | |
} | |
def parse_time(instr, default): | |
instr = instr.strip() | |
if instr == "": | |
return default | |
try: | |
first, second = instr.split(" ", 1) | |
except ValueError: # no AM/PM | |
first = instr | |
second = None | |
hour = int(first.split(":", 1)[0]) | |
if second: | |
if second.lower() == 'pm': | |
hour += 12 | |
elif hour == 12: | |
hour += 12 | |
else: | |
if hour == 0: | |
hour = 24 | |
return hour # discard mins, seconds | |
def avail(start, end, offset): | |
start_utc = start - offset | |
end_utc = end - offset | |
if start_utc < 0 or end_utc < 0: | |
start_utc += 24 | |
end_utc += 24 | |
available = set() | |
for h in range(start_utc, end_utc): | |
available.add(h % 24) | |
return available | |
def tzurl(cities, hour_utc, is_summer): | |
if is_summer: | |
date = f"month=6&day=1" | |
else: | |
date = f"month=12&day=1" | |
time = f"hour={hour_utc}&min=0&sec=0" | |
city_list = list(cities) | |
city_components = [] | |
for i in range(len(city_list)): | |
city_components.append(f"p{i}={city_list[i]}") | |
city_query = "&".join(city_components) | |
url = f"https://www.timeanddate.com/worldclock/meetingdetails.html?{date}&{time}&{city_query}" | |
return url | |
with open(sys.argv[1]) as csvfile: | |
reader = csv.reader(csvfile, 'excel') | |
summer_candidates = set(range(0,23)) | |
winter_candidates = set(range(0,23)) | |
cities = set() | |
for response in reader: | |
if reader.line_num != 1: | |
_, name, timezone, earliest, latest = response | |
start = parse_time(earliest, 5) | |
end = parse_time(latest, 24) | |
summer_offset, winter_offset, tdid = tzlookup[timezone.strip()] | |
cities.add(tdid) | |
summer_available = avail(start, end, summer_offset) | |
winter_available = avail(start, end, winter_offset) | |
print(f"{name}: {start} {end} {summer_offset} {summer_available}") | |
summer_candidates &= summer_available | |
winter_candidates &= winter_available | |
print("Agreeable (Northern) summer UTC hours:") | |
for candidate in summer_candidates: | |
print(f"* UTC+{candidate} - <{tzurl(cities, candidate, True)}>") | |
print() | |
print("Agreeable (Northern) winter UTC hours:") | |
for candidate in winter_candidates: | |
print(f"* UTC+{candidate} - <{tzurl(cities, candidate, False)}>") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can’t perform that action at this time.