Skip to content

Instantly share code, notes, and snippets.

@Kambaa
Created October 7, 2025 17:04
Show Gist options
  • Save Kambaa/7ad6f0e477c7a5dd3987ea1ac2153557 to your computer and use it in GitHub Desktop.
Save Kambaa/7ad6f0e477c7a5dd3987ea1ac2153557 to your computer and use it in GitHub Desktop.
import pandas as pd
import sys
import matplotlib.pyplot as plt
# git log --pretty=format:"%ad" --date=iso > ~/Downloads/commit.txt
# alias gitlog='git log --pretty=format:"%ad" --date=iso > ~/Downloads/commit.txt'
# === Step 1: Full commit times list ===
# commit_times = [line.strip() for line in sys.stdin if line.strip()]
with open("commit.txt", "r", encoding="utf-8") as f:
commit_times = [line.strip() for line in f if line.strip()]
# === Step 2: Convert to DataFrame ===
df = pd.DataFrame({
"raw": commit_times,
"commit_time_utc": pd.to_datetime(commit_times, utc=True, errors="coerce")
})
df = df.dropna(subset=["commit_time_utc"]).copy()
# convert to Istanbul time (UTC+3, handles offsets in log correctly)
df["local_time"] = df["commit_time_utc"].dt.tz_convert("Europe/Istanbul")
# extract useful parts
df["date"] = df["local_time"].dt.date
df["hour"] = df["local_time"].dt.hour
df["weekday"] = df["local_time"].dt.weekday # Mon=0 ... Sun=6
df["off_hours"] = (
(df["hour"] < 9) |
(df["hour"] >= 18) |
(df["weekday"] >= 5)
)
# === Step 3: Plot calendar-style scatter ===
plt.figure(figsize=(14,8))
# Work hours (Mon–Fri, 09–18)
plt.scatter(df["hour"][~df["off_hours"]], df["date"][~df["off_hours"]],
c="skyblue", label="Work Hours (Mon–Fri, 09–18)", alpha=0.7)
# Off hours and weekends
plt.scatter(df["hour"][df["off_hours"]], df["date"][df["off_hours"]],
c="orange", label="Off Hours / Weekend", alpha=0.7)
# Shade weekends with different colors
unique_dates = sorted(df["date"].unique())
for d in unique_dates:
wd = pd.to_datetime(d).weekday()
if wd == 5: # Saturday
plt.axhspan(d - pd.Timedelta(hours=12),
d + pd.Timedelta(hours=12),
color="lightpink", alpha=0.3, label="Saturday" if "Saturday" not in plt.gca().get_legend_handles_labels()[1] else "")
elif wd == 6: # Sunday
plt.axhspan(d - pd.Timedelta(hours=12),
d + pd.Timedelta(hours=12),
color="lightyellow", alpha=0.3, label="Sunday" if "Sunday" not in plt.gca().get_legend_handles_labels()[1] else "")
# Set X-axis ticks (hours)
plt.xticks(range(0,24,2))
plt.xlabel("Hour of Day")
# Set Y-axis ticks to every unique date
plt.yticks(unique_dates) # Display every unique date
plt.ylabel("Date")
plt.title("Commit Calendar: Work vs Off-Hours & Weekends", fontsize=16)
plt.legend(loc="upper center", bbox_to_anchor=(0.5, -0.1), ncol=3)
plt.grid(True, linestyle="--", alpha=0.5)
plt.tight_layout()
# === Step 4: Save chart ===
plt.savefig("commit_calendar.png", dpi=300)
print("Commit calendar saved as commit_calendar.png")
# Show interactively (optional)
plt.show()
2025-10-03 23:47:11 +0300
2025-10-03 15:46:11 +0300
2025-10-03 15:43:40 +0300
2025-10-03 15:41:25 +0300
2025-10-02 17:34:51 +0300
2025-10-02 17:18:20 +0300
2025-10-02 16:58:50 +0300
2025-10-02 16:45:24 +0300
2025-10-02 16:18:30 +0300
2025-10-02 15:36:34 +0300
2025-10-02 12:33:39 +0300
2025-10-02 12:30:03 +0300
2025-10-02 10:58:39 +0300
2025-10-02 10:40:26 +0300
2025-10-02 10:30:45 +0300
2025-10-02 10:29:25 +0300
2025-10-02 10:23:04 +0300
2025-10-02 09:44:01 +0300
2025-10-02 08:47:00 +0300
2025-10-02 08:46:02 +0300
2025-10-02 08:44:53 +0300
2025-10-02 08:38:15 +0300
2025-10-02 08:35:39 +0300
2025-10-02 08:32:28 +0300
2025-10-02 08:30:31 +0300
2025-10-02 08:27:35 +0300
2025-10-02 08:27:05 +0300
2025-10-02 08:26:20 +0300
2025-10-02 08:23:49 +0300
2025-10-01 12:09:58 +0300
2025-10-01 11:32:29 +0300
2025-10-01 11:02:27 +0300
2025-10-01 07:11:38 +0300
2025-10-01 07:06:01 +0300
2025-09-30 18:18:00 +0300
2025-09-30 18:12:17 +0300
2025-09-30 18:10:22 +0300
2025-09-30 18:07:29 +0300
2025-09-30 18:02:41 +0300
2025-09-30 18:02:29 +0300
2025-09-30 18:01:31 +0300
2025-09-30 17:52:45 +0300
2025-09-30 17:46:31 +0300
2025-09-30 17:38:38 +0300
2025-09-30 17:28:45 +0300
2025-09-30 16:54:44 +0300
2025-09-30 16:49:51 +0300
2025-09-30 16:48:09 +0300
2025-09-30 16:45:37 +0300
2025-09-30 16:44:01 +0300
2025-09-30 14:34:17 +0300
2025-09-30 13:53:27 +0300
2025-09-30 12:27:07 +0300
2025-09-30 11:55:29 +0300
2025-09-30 11:36:05 +0300
2025-09-30 11:34:03 +0300
2025-09-30 10:16:14 +0300
2025-09-30 10:14:50 +0300
2025-09-30 08:50:43 +0300
2025-09-29 21:01:36 +0300
2025-09-29 20:19:02 +0300
2025-09-29 19:46:45 +0300
2025-09-29 18:22:47 +0300
2025-09-29 18:15:44 +0300
2025-09-29 17:10:24 +0300
2025-09-29 17:06:09 +0300
2025-09-29 16:57:58 +0300
2025-09-29 16:55:30 +0300
2025-09-29 16:48:41 +0300
2025-09-29 16:47:21 +0300
2025-09-29 16:37:55 +0300
2025-09-29 16:36:15 +0300
2025-09-29 16:01:25 +0300
2025-09-29 15:49:26 +0300
2025-09-29 15:43:42 +0300
2025-09-29 15:39:15 +0300
2025-09-29 15:28:19 +0300
2025-09-29 15:19:54 +0300
2025-09-29 14:38:20 +0300
2025-09-29 14:36:35 +0300
2025-09-29 14:33:23 +0300
2025-09-29 14:25:17 +0300
2025-09-29 14:19:46 +0300
2025-09-29 14:17:51 +0300
2025-09-29 13:52:18 +0300
2025-09-29 13:26:11 +0300
2025-09-29 12:18:11 +0300
2025-09-27 16:11:51 +0300
2025-09-27 16:10:39 +0300
2025-09-27 16:00:52 +0300
2025-09-27 15:56:23 +0300
2025-09-27 15:53:39 +0300
2025-09-27 15:48:30 +0300
2025-09-27 15:45:32 +0300
2025-09-27 14:48:07 +0300
2025-09-27 14:46:43 +0300
2025-09-27 14:45:19 +0300
2025-09-27 14:40:00 +0300
2025-09-27 14:21:16 +0300
2025-09-27 14:18:22 +0300
2025-09-27 14:13:02 +0300
2025-09-27 13:00:10 +0300
2025-09-27 12:15:28 +0300
2025-09-27 12:12:01 +0300
2025-09-27 11:48:03 +0300
2025-09-27 11:25:09 +0300
2025-09-27 10:52:13 +0300
2025-09-27 00:24:18 +0300
2025-09-27 00:05:06 +0300
2025-09-26 23:39:58 +0300
2025-09-26 21:40:38 +0300
2025-09-26 21:37:34 +0300
2025-09-26 21:33:53 +0300
2025-09-26 21:26:53 +0300
2025-09-26 21:25:16 +0300
2025-09-26 21:23:12 +0300
2025-09-26 21:19:53 +0300
2025-09-26 21:12:54 +0300
2025-09-26 21:11:04 +0300
2025-09-26 21:07:11 +0300
2025-09-26 21:04:02 +0300
2025-09-26 21:02:55 +0300
2025-09-26 20:50:39 +0300
2025-09-26 20:49:32 +0300
2025-09-26 20:48:10 +0300
2025-09-26 20:46:27 +0300
2025-09-26 20:33:24 +0300
2025-09-26 20:24:29 +0300
2025-09-26 20:20:00 +0300
2025-09-26 20:18:56 +0300
2025-09-26 20:18:46 +0300
2025-09-26 19:57:49 +0300
2025-09-26 19:54:44 +0300
2025-09-26 19:53:25 +0300
2025-09-26 16:47:36 +0300
2025-09-26 16:35:21 +0300
2025-09-26 16:27:33 +0300
2025-09-26 16:19:02 +0300
2025-09-26 15:17:01 +0300
2025-09-26 12:49:16 +0300
2025-09-25 19:08:14 +0300
2025-09-25 18:33:35 +0300
2025-09-25 16:28:58 +0300
2025-09-25 16:20:51 +0300
2025-09-25 16:16:26 +0300
2025-09-25 16:15:58 +0300
2025-09-25 16:07:55 +0300
2025-09-25 16:05:49 +0300
2025-09-25 15:57:12 +0300
2025-09-25 14:48:49 +0300
2025-09-25 14:34:07 +0300
2025-09-25 14:26:02 +0300
2025-09-25 14:23:35 +0300
2025-09-25 14:19:11 +0300
2025-09-25 13:49:06 +0300
2025-09-25 13:29:15 +0300
2025-09-25 13:16:05 +0300
2025-09-25 13:14:41 +0300
2025-09-25 13:13:26 +0300
2025-09-25 13:08:43 +0300
2025-09-25 13:08:05 +0300
2025-09-25 13:07:32 +0300
2025-09-25 13:06:57 +0300
2025-09-25 13:01:37 +0300
2025-09-25 12:02:52 +0300
2025-09-24 22:28:03 +0300
2025-09-24 22:18:33 +0300
2025-09-24 22:14:21 +0300
2025-09-24 21:38:35 +0300
2025-09-24 21:27:23 +0300
2025-09-24 19:03:52 +0300
2025-09-24 18:51:15 +0300
2025-09-24 17:55:06 +0300
2025-09-24 15:51:01 +0300
2025-09-24 15:34:30 +0300
2025-09-24 15:18:25 +0300
2025-09-24 14:35:27 +0300
2025-09-24 14:25:15 +0300
2025-09-24 14:13:17 +0300
2025-09-24 14:06:59 +0300
2025-09-24 13:45:26 +0300
2025-09-24 13:45:10 +0300
2025-09-24 13:41:29 +0300
2025-09-24 12:18:30 +0300
2025-09-24 11:35:37 +0300
2025-09-24 10:18:15 +0300
2025-09-24 08:14:51 +0300
2025-09-24 07:42:56 +0300
2025-09-24 07:33:05 +0300
2025-09-23 22:00:03 +0300
2025-09-23 21:57:18 +0300
2025-09-23 21:52:39 +0300
2025-09-23 20:56:27 +0300
2025-09-23 20:53:18 +0300
2025-09-23 20:40:53 +0300
2025-09-23 19:57:52 +0300
2025-09-23 19:56:28 +0300
2025-09-23 19:52:32 +0300
2025-09-23 19:49:11 +0300
2025-09-23 19:28:38 +0300
2025-09-23 18:59:46 +0300
2025-09-23 16:02:11 +0300
2025-09-23 16:00:27 +0300
2025-09-23 15:22:37 +0300
2025-09-23 14:31:28 +0300
2025-09-23 13:26:19 +0300
2025-09-23 13:24:40 +0300
2025-09-23 10:20:09 +0300
2025-09-23 09:10:30 +0300
2025-09-23 09:05:06 +0300
2025-09-22 18:06:37 +0300
2025-09-22 18:05:29 +0300
2025-09-22 16:33:01 +0300
2025-09-22 15:20:11 +0300
2025-09-20 01:32:26 +0300
2025-09-20 01:31:35 +0300
2025-09-20 01:18:45 +0300
2025-09-20 01:13:05 +0300
2025-09-20 00:58:50 +0300
2025-09-20 00:55:40 +0300
2025-09-19 23:13:15 +0300
2025-09-19 22:27:31 +0300
2025-09-19 17:37:02 +0300
2025-09-19 17:20:20 +0300
2025-09-18 16:52:57 +0300
2025-09-18 15:46:25 +0300
2025-09-18 11:15:03 +0300
2025-09-18 11:07:34 +0300
2025-09-18 10:39:40 +0300
2025-09-18 10:17:50 +0300
2025-09-18 09:09:32 +0300
2025-09-18 08:23:55 +0300
2025-09-18 07:57:49 +0300
2025-09-17 23:58:58 +0300
2025-09-17 23:10:44 +0300
2025-09-17 21:51:19 +0300
2025-09-17 20:16:33 +0300
2025-09-17 20:15:50 +0300
2025-09-17 19:20:47 +0300
2025-09-17 19:19:57 +0300
2025-09-17 19:18:45 +0300
2025-09-17 19:05:23 +0300
2025-09-17 19:01:43 +0300
2025-09-17 14:03:20 +0300
2025-09-17 12:05:00 +0300
2025-09-17 11:50:30 +0300
2025-09-17 09:44:19 +0300
2025-09-17 09:43:27 +0300
2025-09-16 19:00:58 +0300
2025-09-16 18:25:41 +0300
2025-09-16 17:03:25 +0300
2025-09-16 15:59:01 +0300
2025-09-16 14:04:38 +0300
2025-09-16 13:56:23 +0300
2025-09-16 13:55:44 +0300
2025-09-16 11:33:23 +0300
2025-09-16 10:33:56 +0300
2025-09-16 10:02:10 +0300
2025-09-16 09:18:49 +0300
2025-09-16 09:17:58 +0300
2025-09-15 21:47:14 +0300
2025-09-15 21:39:33 +0300
2025-09-15 20:59:55 +0300
2025-09-15 16:59:03 +0300
2025-09-15 14:18:41 +0300
2025-09-13 18:05:14 +0300
2025-09-13 14:16:59 +0300
2025-09-13 13:45:45 +0300
2025-09-13 12:53:56 +0300
2025-09-13 12:48:16 +0300
2025-09-13 00:36:00 +0300
2025-09-12 22:25:41 +0300
2025-09-12 22:19:02 +0300
2025-09-12 21:14:17 +0300
2025-09-11 18:04:21 +0300
2025-09-11 16:37:13 +0300
2025-09-11 14:53:06 +0300
2025-09-10 23:46:14 +0300
2025-09-10 23:43:59 +0300
2025-09-10 18:00:15 +0300
2025-09-10 15:56:29 +0300
2025-09-10 10:24:58 +0300
2025-09-10 10:04:29 +0300
2025-09-10 08:24:04 +0300
2025-09-10 06:57:24 +0300
2025-09-09 19:38:50 +0300
2025-09-09 19:36:33 +0300
2025-09-09 18:10:07 +0300
2025-09-09 06:39:42 +0000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment