Skip to content

Instantly share code, notes, and snippets.

View emirhg's full-sized avatar

Emir Herrera González emirhg

View GitHub Profile
#!/usr/bin/env python3
# API is here: https://taskwarrior.org/docs/hooks.html
# To be saved at ~/.task/hooks/on-modify.01-gnome-pomodoro to ensure it is
# run after the timewarrior hook, which should be saved as
# ~/.task/hooks/on-modify.00-timewarrior
# Otherwise, this is run before which then runs the Gnome-Pomodoro actions
# things get quite messy!
import json
#!/usr/bin/env python3
# TaskWarrior Hook for ActivityWatch
# Author: Emir Herrera González
# Inserts a TaskWarrior activity when a Task is stopped
# License: GNU GPLv3
from datetime import datetime, timezone
from time import sleep
@emirhg
emirhg / retrive-bitso-crypto-mx-prices-as-csv.sh
Last active February 21, 2021 10:08
Get last Bitso Cryptocurrencies prices
# This Command retrives te lasts Crypto currencies prices on MXN from Bitso and writes a CSV file propper for GNUCash Importation
curl "https://api.bitso.com/v3/ticker" | jq -r '.payload | map([.book, .last]) | .[] | @csv' | sed -e "s/_/\",\"/g;s/^/\"$(date +%Y-%m-%dT%H:%M:%S%z)\",\"CRYPTOCURRENCY\",/g" | tr a-z A-Z > /tmp/security_prices.csv
@emirhg
emirhg / prepare-commit-msg
Last active July 3, 2021 11:36
prepare-commit-msg
#!/bin/zsh
# Author: "Emir Herrera" <emir.herrera@gmail.com>
# Donations: http://paypal.me/emirhg
#
# A GIT Hook to Pregenerate a Commit Message with an elapsed working time taken from the time tracker ActivityWatch. A `ref #123 @1.h` message like is generated taking the activity number from the branch name and te time from ActivityWatch Web API. Requires JQ in order to add all the events recorded by ActivityWatch
#
# Usage:
#
# copy this file under "${GIT_WORKING_TREE}/.git/hooks/prepare-commit-msg and set execution permitions
#