Skip to content

Instantly share code, notes, and snippets.

View gpoulter's full-sized avatar

Graham Poulter gpoulter

View GitHub Profile
@gpoulter
gpoulter / winstats.fish
Last active May 2, 2023 10:45
Log active application window every few seconds
#!/usr/bin/fish
# Regularly logs the active application and window title to a CSV file.
# Project name to include in the filename.
set project "none"
# Duration in seconds of samples, sleep until timestamp divisible.
set duration 60
@gpoulter
gpoulter / track.fish
Last active May 2, 2023 10:45
Track time using timelapse.sh and winstats.sh scripts
#!/usr/bin/fish
#
# Tracks window titles and records a timelapse for specified duration.
#
# Duration for running the tracker - quits after sleeping this long.
set duration "25m"
# Name of project to record in the time entries.
set project "none"
@gpoulter
gpoulter / timelapse.fish
Last active May 2, 2023 10:45
Debian Screen Recording
#!/usr/bin/fish
# Uses ffmpeg to record a timelapse video of the X11 screen.
#
# Global Flags:
# -loglevel: Verbosity
#
# Input Flags:
# -framerate: screenshots to capture per second
# -f: input format
@gpoulter
gpoulter / jpeg_caption_from_name.py
Created April 10, 2012 13:22
Set EXIF caption from JPEG filename
#!/usr/bin/env python
"""
1) Start with a directory full of DSC_003242.jpg files from the camera.
2a) Download jhead.exe and save it as C:\jhead.exe
http://www.sentex.net/~mwandel/jhead/
2b) Go to Start Menu, "Run..." and enter "cmd" to open a DOS box. Change
to the image directory, and run "C:\jhead.exe -nf *.jpg" so all the files look like
@gpoulter
gpoulter / multihypergeo.py
Created April 10, 2012 13:19
Multi-hypergeometric distribution
#!/usr/bin/python
"""Calculates the distribution of a weighted sum of the components of
a multivariate hypergeometric random variable, for the special case of
three components with weights -1, 0 and +1 - although the generating
function can handle any weights and number of components. Given a
value t, it also calculates the p value of t under the null hypothesis
that it was generated as the weighted sum of the multivariate
hypergeometric variable.
@gpoulter
gpoulter / csv_to_mm.py
Created April 10, 2012 11:32
Build Freemind MindMap from Excel file
#!/usr/bin/python
"""Convert CSV table to MindMap format
Usage: python csv_to_mm.py sometable.csv > mymap.mm
CSV format is rows representing tree leaves, e.g.:
A1,
A1,B1
A1,B1,C1
A1,B1,C2