Skip to content

Instantly share code, notes, and snippets.

Processing Timetrap Output for Invoicing

Process and Awk Draft

t display --format csv > tmp.csv

Latest Awk for My Timetrap/Pandoc/LaTeX Invoicing System

Output is YAML for use as Pandoc metadata. The YAML contains LaTeX strings. \quad and \hphantom come in handy for spacing LaTeX item lists in the invoice template I'm using.

# Process tsv generated from timetrap.rb display output
@trauber
trauber / README.md
Last active January 29, 2020 19:11

Timetrap TSV Formatter

Hacked from csv.rb.

module Timetrap
  module Formatters
    class Tsv
 attr_reader :output

Notes for Sqlite Blog

  • Create a sqlite timestring with date:
date +'%Y-%m-%d %H:%M'
  • Read text file into a blob:

Bash for Times to Use with Remind

# Calculate number of minutes since start of day.
# Use this with output of `remind -s` to calculate
# task duration.

GENERIC_DATE=$(date +'%b %d %Z %Y') # Example output: "Feb 23 EST 2020"
START_OF_DAY_IN_SECONDS_SINCE_THE_EPOCH=$(date --date="$GENERIC_DATE" +'%s') # That date spec provides sste at midnight.
NOW_IN_SECONDS_SINCE_THE_EPOCH=$(date +'%s')

Python Namedtuple to Dict to JSON

I've patched this together from several different tutorials.

from collections import namedtuple
import json

dict_list = []

HTML for WordPress Responsive Columns

This uses classes from /wp-includes/css/dist/block-library/style.min.css?ver=5.4.1 .

<div class="contain">
  <div class="wp-block-columns alignwide has-3-columns">
    <div class="wp-block-column">...</div>
    <div class="wp-block-column">...</div>
 ...

Processing iContacts HMTL Email into WordPress

  • Download the message. This yields a .eml file.
  • Run munpack on the .eml file. This will break the file into several files named part1 part2, etc, one of which will be HTML with some non-ascii characters. Let's say part2 for example.

This might work with other HTML emails. I've only tried iContacts.

munpack -t file.eml
awk '{ gsub(/\377/,""); print; }' part2 > tmp.html

Just added some custom css to TS theme in "customize->additional css".

h1.entry-title {
box-sizing: border-box;
color: rgb(53, 53, 53);
font-family: Alice;
font-size: 38px;
font-weight: 600;
@trauber
trauber / slides.md
Created October 29, 2020 17:53
slides

Slide one


Slide two

???

with notes