Freddy Ewald Personal Website

Posts


  • How much Precision do you need?

    Probably not so much, or at least less than you might think.

    We often need to store dates and times in a database and retrieve them later. I have seen people choosing to store those in the highest precision available. For example, in Python the precision for a datetime object is microseconds. That is one millionth of a second!

    For a lot of use cases, this kind of precision is not needed. For many cases, second precision is enough. Examples for use-cases that probably don’t need the highest precision are:

    • Blog posts
    • Comments
    • Social networks
    • Audit logs

    Furthermore, it makes sense to use the same precision in your code as in your database. By doing so, you get the exact same date and time when you save an object to the database and when you retrieve it later. This is especially important in tests where exact equality is tested.

    One example is MySQL which has the DATETIME(3) type where the number denotes the sub-second precision. Defining the precision explicitly makes it not only more predictable in your code, it also avoid wasting space.

    As usual, it depends on the use case. It does make sense to think a little bit about the precision to avoid problems later in the development process.

  • Jekyll Compose

    I was looking for an easy way to create new jekyll posts via command line and found the plugin Jekyll compose. I am very late to the party but wanted to give this a little bit more visibility as I have used a more bare-bones Jekyll beforehand.

    Installation is simple via:

    gem 'jekyll-compose', group: [:jekyll-plugins]
    bundle

    Usage:

    bundle exec jekyll post "My new post"

  • Show full URL in Google Chrome

    To show the full URL in Chrome, right click on the address bar and check “Always show full URLs”. This shows the http(s) portion of the URL in all cases and not only the domain name.

    Show full URL in Google Chrome

  • Sunset in Daly City, California

    Sunset in Daly City, California

  • Introducing hermes: A CLI tool for Apple iMessage

    I just released the first version v0.1.0 of hermes on my Github account. Hermes is named after the Greek god - the messenger of Mount Olympus.

    With hermes you can analyze you iMessage display statistics of your iMessage database on the command line and extract conversations. The supported formats at this time are JSON, plain text and YAML.

    An example looks like this:

    $ hermes statistics
    Total messages:    100000
    Received messages: 40000
    Sent messages:     60000
    Daily Average:     45.66
    Monthly Average:   <Not available>
    Yearly Average:    <Not available>
    Chats:             30
    

    Installing hermes

    To install hermes, you can follow the instructions in the readme.

    There are two ways of installing hermes.

    1. Download the latest binary from the releases page. I am providing 64 bit binaries for both Intel and ARM architectures for MacOS.
    2. Build hermes from source with go install github.com/f-ewald/[email protected]. This will get you the most up to date version.

    After installing it, you can use it with either hermes or ./hermes, depending on your installation location.

    Usage

    The simplest way to get started is to call hermes directly and follow the instructions from the help. At the moment, there are two main commands available: statistics and conversations.

    % ./hermes
    Hermes is a command-line interface for iMessage databases.
    You can use it to analyze and display retrieveConversations and view statistics.
    
    Usage:
      hermes [command]
    
    Available Commands:
      check        Validate the environment
      completion   Generate the autocompletion script for the specified shell
      conversation Show retrieveConversations, find participants
      help         Help about any command
      statistics   Display message statistics
    
    Flags:
          --config string     config file (default is $HOME/.hermes.yaml)
      -d, --database string   Full path to the chat database if it is different than the default path.
      -h, --help              help for hermes
      -o, --output string     The output format. Can be either json, yaml or text (default "text")
    
    Use "hermes [command] --help" for more information about a command.
    

    You can view statistics with the statistics command.

    To display conversations, use the conversations list command. This returns a list of all conversations sorted by internal id together with the participants. If this is a one-to-one conversation, there will be only one participant. Group conversations have multiple participants.

    To show the conversation, use the conversation get <id> command. Replace <id> with the unique conversation identifier that can be obtained from the list command. The conversation will contain the participants and all messages ordered by date. Each message is prefixed with the unique participant identifier.

    Troubleshooting

    The most common issue is that there is no access to the iMessage database due to MacOS’ system restrictions. This can be solved by giving the terminal “Full Disk Access” in the system settings und the “Security Tab”.

    Full Disk Access in the System security settings

    Future plans

    I am planning to write tests for main parts of the software. Right now, there are no known bugs, but is not in an ideal state. After this, I am planning to improve the help and access to the database. Due to MacOS’ increased security features over the last years, you currently need to give your terminal full disk access or copy the database to another location, both of those approaches are not ideal.

    Contributing/Bug Reporting

    If you want to contribute to hermes, feel free to get in touch with me or create a pull request on Github.

    If you have any interesting ideas for statistics that you would like to display but don’t know how to implement them, you can also get in touch with me via email via [email protected]

Page: 3 of 14