Skip to content

Instantly share code, notes, and snippets.

View millerdev's full-sized avatar

Daniel Miller millerdev

  • Dimagi, Inc.
View GitHub Profile
@millerdev
millerdev / clockify-hide-pto.user.js
Last active August 28, 2025 11:57
Greasemonkey script to hide requested PTO from the Clockify time tracker view
// ==UserScript==
// @name Clockify - hide PTO
// @description Hides PTO cards in Clockify time tracker. Requested/future PTO takes up a lot of space at the top of the time tracker, which pushes today's time entries down in the list. This script hides PTO entries by default, and adds a button to toggle their visibility.
// @version 1.5
// @include https://dimagi.clockify.me/tracker*
// @grant none
// ==/UserScript==
//
// Mostly written by ChatGPT with minor modifications.
// Source: https://gist.github.com/millerdev/571f894f7b71b55168fab694d636f125
@millerdev
millerdev / prattparse.py
Last active April 3, 2024 14:50
Pratt Parsers: Expression Parsing Made Easy
# Pratt Parser in Python
# https://journal.stuffwithstuff.com/2011/03/19/pratt-parsers-expression-parsing-made-easy/
#
# Works with input like `a + b`.
# The lexer does not support numbers (yet).
#
# https://gist.github.com/millerdev/03d881620dd0879d4347b0e971ff0be5
from dataclasses import dataclass
@millerdev
millerdev / gtk.css
Created March 15, 2021 14:43
Gnome CSS customizations - mainly narrower titlebar
/*
Gnome 3 - based on https://blog.samalik.com/make-your-gnome-title-bars-smaller/
https://securitronlinux.com/bejiitaswrath/how-to-make-the-title-bars-in-gnome-shell-much-thinner-than-the-default/
sizes tweaked to make the close button bigger on 20.04 (not tested on earlier versions)
Copy or symlink to ~/.config/gtk-3.0/gtk.css
To change titlebar font from Bold to normal (maybe there is CSS for this too?):
$ gsettings get org.gnome.desktop.wm.preferences titlebar-font
'Ubuntu Bold 12'
#! /usr/bin/env python
"""Download events form Sentry as CSV
https://gist.github.com/millerdev/3d0a541f90b9817c3be5dd9bffed288e
"""
import sys
import csv
from argparse import ArgumentParser
import requests
@millerdev
millerdev / rm-future.py
Last active August 23, 2019 15:44
Remove __future__ imports from Python files
#! /usr/bin/env python
"""Remove __future__ imports from Python files
Acts on *.py files in the current directory and all subdirectories.
Only removes lines in which all imported names are in KNOWN_FUTURES.
Public URL of this script:
https://gist.github.com/millerdev/f71648c1a9690cfca7c8b7c049867cfc
"""
@millerdev
millerdev / bucket_domains.py
Last active March 19, 2020 20:21
Categorize CommCare HQ domains needing couch -> sql migration of forms and cases
#!/usr/bin/env python
# coding: utf-8
"""
DEPRECATED moved to
https://github.com/dimagi/commcare-hq/blob/master/corehq/apps/couch_sql_migration/management/commands/couch_domain_report.py
Categorize CommCare HQ domains needing couch -> sql migration of forms and cases
This script requires a domains.csv file, which can be obtained by following
these steps:
@millerdev
millerdev / delete_gmail.py
Last active July 1, 2019 17:40
Permanently bulk-delete messages from gmail
#! /usr/bin/env python3
"""Permanently delete messages from Gmail
WARNING: THIS SCRIPT CAN DO GREAT DAMAGE TO YOUR GMAIL ACCOUNT.
USE AT YOUR OWN RISK!
Setup guide:
1. Create and activate a new virtualenv with Python 3
@millerdev
millerdev / steps.md
Last active April 10, 2026 14:50
Upgrade to new version of PostgreSQL in docker

This is now OBSOLETE, it has been moved into CommCare HQ.

Upgrade to new version of Postgres in Docker

This example upgrades PostgreSQL 9.4 to 9.6. Substitute the versions you're upgrading to/from as needed below.

Dump all databases to a file

Run the following command to make a backup of all postgres data in a local file:

@millerdev
millerdev / generate-locations.py
Last active July 6, 2018 14:37
Generate XLSX file containing CommCare locations
#! /usr/bin/env python
"""Generate XLSX file containing CommCare locations
Requires: pip install openpyxl==2.2.5
https://gist.github.com/millerdev/57a5c1363773a92d9ee6332e79789cd3
"""
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
@millerdev
millerdev / riak-vnode-check.py
Last active January 3, 2018 20:22
Check for distinct replicas on riak cluster nodes for a given n_val
#! /usr/bin/env python
"""
Check for replicas on distinct nodes within a riak cluster for a given n_val
https://gist.github.com/millerdev/b6f50640d5fc2519ae8c9c2de3c64af2
"""
import re
from argparse import ArgumentParser
from subprocess import check_output