Random ramblings about Mac, Python, TeX, programming, and more   |     |        |     |  



Web page interaction in Python

November 14, 2024  |  web, python, programming

Some of my routine tasks involve interaction with web pages, often to fill in one or more web forms with data that can be provided programmatically. With my previous email provider, I used this to add new email aliases to my email account. Now, I need it to send documents to our work printers. To ease these tasks, I developed a very simple (and limited) Python-based web interaction scripting lang …

Last updated: November 22, 2024

A nicer web-based file browser with the NGNIX Fancy Index module

June 21, 2024  |  web, fonts, programming
This post is part of a series of posts where I share my experiences developing, testing, and debugging the new implementation of my website, including this blog and my home page.

When I made the new implementation of my website, I included a file browser for my file repository with files that I would like to share. With NGNIX, this is extremely easy to achieve. Just enable autoindex for the given …

Last updated: June 22, 2024

Using OrbStack to test and debug my website implementation

June 12, 2024  |  web, python, programming
This post is part of a series of posts where I share my experiences developing, testing, and debugging the new implementation of my website, including this blog and my home page.

When I developed my new website, I used OrbStack to run a virtual developer version of the site on my development computer (the host). I recommend this setup since what you run in development can be very close to the sit …

Last updated: October 24, 2024

A Debain/NGNIX/Gunicorn setup for web.py

May 22, 2024  |  web, python, programming
This post is part of a series of posts where I share my experiences developing, testing, and debugging the new implementation of my website, including this blog and my home page.

In this post, I will describe how I did the setup of a Debian Linux computer for my web.py web applications served by NGINX and Gunicorn. The same setup is used both on my live site hosted on Linode and on my OrbStack vi …

Last updated: October 24, 2024

Experiences from developing a new website

May 15, 2024  |  web, python, programming
This post is part of a series of posts where I share my experiences developing, testing, and debugging the new implementation of my website, including this blog and my home page. At the end of this post, you will find links to the other posts.

I've had a side project re-implementing this blog and my web pages for a while. In January 2021, I moved the blog and web pages to a Linode-hosted web platf …

Last updated: June 22, 2024

MarsEdit

May 12, 2024  |  web, blog, software, macos

My first blog post on this blog was posted September 14, 2007, just titled «The first posting». The whole content of the post was this:

This is my first posting on Blogger. This blog (feed) is my private blog where I will post stuff not related to work. This posting is also a test of MarsEdit, the blog publisher I've started to use today. I have a license for MarsEdit 1, but I will upgrade to ver …
Last updated: June 22, 2024

Beaker and PyCrypto (and web session data)

April 23, 2024  |  web, python, crypto, programming
This post is part of a series of posts where I share my experiences developing, testing, and debugging the new implementation of my website, including this blog and my home page.

In web development, I have started to use Beaker (documentation) to handle session data (e.g., current logged in user in a session). The data for a given session can be stored in files, in a database, in memory (does no …

Last updated: June 22, 2024

Programming fonts (and online preview)

March 8, 2024  |  fonts, tools, programming

In 2012, I wrote about coding fonts, and still, my preferred programming font is Source Code Pro. I have updated the post from 2012 a couple of times with new interesting fonts for coding, and I continue to look for new fonts that could be a replacement for my preferred programming font. Yesterday, via Charles Roper, I came over the font Intel One Mono designed by Frere-Jones Type for Intel. I th …

Last updated: March 9, 2024

Emacs on macOS

December 29, 2023  |  tools, programming, macos

I do almost all my programming and scientific writing in Emacs, and I am a Mac user running a recent version of macOS (usually the latest release available). I try to install most of the third-party software I use with Homebrew. It makes it much easier to install the software I need (including Emacs, BSD make, OpenSSL, Python, and Qt) and keep the software updated (regularly running the command «b …

Last updated: December 29, 2023

Mailspring and keyboard shortcuts

April 19, 2023  |  software, tools, macos

Mailspring is a free mail client for Mac, Linux, and Windows (a paid Pro version is also available). Mailspring's user interface (UI) is open source (GPLv3). It is built on a plugin architecture and is designed to be easy to extend.

I have started using Mainspring on macOS recently, and since I find keyboard shortcuts important when using an email client efficiently, Mailscript's highly configurab …

Last updated: June 22, 2024

Add artwork and thumbnails to video files

October 22, 2021  |  software, tools, macos

I just converted a lot of home videos from VHS to MP4 files. I planned to upload and view the resulting files on my iPad. I used HandBrake to reduce the size of the files and WALTR PRO (remember to turn of Automatic Content Recognition in the Preferences) to transfer the videos to my iPad. But, before I transferred them to the iPad, I wanted to add a title and an artwork image to the metadata of e …

Last updated: June 22, 2024

Server side IMAP rules

June 3, 2021  |  tools, python

I'm using several email services, but most of my private email is on an IMAP-based service. A lot of the received emails should be automatically moved to a sub-folder on the server without my involvement. In most email clients, you can easily create rules to do this. However, I would like to do this even when I have no email clients up and running. For my work email service (Outlook) this can be …

Last updated: June 22, 2024

Get the notes out of Apple Notes into OneNote (via Evernote) with AppleScript

April 9, 2021  |  tools, programming, macos

I have been using Apple Notes for all my note-taking since 2016. For not-so-interesting reasons, I recently had to change to Microsoft OneNote. However, I did not want to leave all my meeting notes behind. I had to find a solution to get all my notes out for Apple Notes. And as many times before, AppleScript (and Python) was part of the solution.

My first attempt was to search for possible tools o …

Last updated: June 22, 2024

Keysmith

January 28, 2021  |  software, tools, macos

In a previous posting, I explained how to use Apple Script to automate an action and connect it to a keyboard shortcut. Recently, I changed the approach for several such actions on my Macs. The new approaches are all based on Keysmith. My experience is that the resulting actions from Keysmith are executed much more efficiently than my previous solution.

Update, June 25 2024

Sometimes, I experience …

Last updated: June 25, 2024

Microsoft Outlook: download pictures

February 12, 2020  |  tools, programming, macos

I am currently on my Mac using the Microsoft Outlook application for email. For a lot of reasons, I have turned off automatically downloading pictures from the Internet (see Preferences→Reading→Security). But sometimes, I want to see the pictures included in the email message I am reading. I can push the button Download pictures to see them. However, I prefer to use the keyboard. I have not found …

Last updated: June 22, 2024

Including source code in this blog

January 31, 2020  |  web, publ, programming, macos

I write these blog posts with MarsEdit. And, while I am writing, I preview the blog post with Marked 2 (start Marked 2 and choose Preview → MarsEdit Preview from the menu). And since my writing usually is about programming, the blog posts might contain source code. My approach is similar to how I include source code in papers, and I was writing about it back in 2015. So, this is an update on how I …

Last updated: June 22, 2024

Emacs on Mac

September 26, 2018  |  os-x, software, tools, programming

Until recently, I have been an Aquamacs user on the Mac. However, recently, I have been switching back to a more standard Emacs distribution for Mac. After some time of research, I ended up with the Emacs Mac Port. This distribution is easily installed and updated through Homebrew, and since I am already using Homebrew for other important software on my Mac (including bsdmake), this was an obvious …

Last updated: June 22, 2024

Using PlistBuddy when I want to open Emacs from a link in an HTML file on OS X

December 14, 2017  |  web, os-x, software, programming

Previously, I have discussed How to open Emacs from a link in an HTML file on Mac OS X. This post is just to give a complete overview of how this can be done without too many manual tasks. My complete AppleScript program and its Makefile is available for download. It should only be used with your own modification.  It includes the usage of cvs to commit the changes in the bib files to my local cvs …

Last updated: June 22, 2024

Run all Airmail rules

October 26, 2017  |  os-x, tools, programming

I currently use Airmail as my Mac (and iOS) mail client. With many email accounts I found that Airmail fits my needs OK. And I have created a large number of rules that are automatically performed on new emails in my inbox. However, for different reasons I would sometimes like to perform all my rules manually. As far as I know this is not possible in the Mac version of Airmail. So, I had to implem …

Last updated: June 22, 2024

Open Emacs from a link in an HTML file on Mac OS X

December 14, 2015  |  web, os-x, programming

Since I do most of my writing in LaTeX, I have all my references (publications I cite when I write papers) in a series of bib-files (for BibTeX). To easier browse and search these references I have created a small Python script that generates a HTML document with all these references. Each reference also includes a link to the bib-file this reference was found in. In the link, I include the key of …

Last updated: June 22, 2024

Cryptography with Python 3

May 15, 2015  |  os-x, tools, python, crypto, programming

In 2012 I posted a post on using PyCrypto with Python 3 and some AES and RSA examples. Now, I usually use the cryptography Python library (implemented for both Python 2 and 3). I have ported all my PyCrypto examples from 2012 (see the README file) to the cryptography library.

pycryptex.py / pycryptex-cbc.py

pycryptex.py [src] is a small example using AES to encrypt and decrypt a text:

> python3 pycry …
Last updated: June 22, 2024

Run automator workflow with keyboard shortcuts

April 27, 2015  |  os-x, tools, programming

In the last post we demonstrated how to automate a task using AppleScript and the Fake scriptable web browser. Often, I use Automator included on every Mac to perform such tasks. To activate them, we bind them to a keyboard shortcut in the given application. The example we will use today is to press a keyboard shortcut to load the remote content of an email in Mail.app (you have of course turned o …

Last updated: June 21, 2024

Automate tasks with AppleScript, Fake, and the keychain

April 27, 2015  |  web, os-x, tools, programming

You can make life a lot easier on your Mac if you learn how to automate things. The standard approach to do this on Macs is to use Automator (see How to use Automator: What Automator is and how it works from Macworld UK). If you include AppleScript, Fake, and the keychain in your toolchain, you can achieve even more. As an example I will develop an automated task to create a new email alias using …

Last updated: June 21, 2024

Including source code in papers and on the web

March 20, 2015  |  web, publ, tools, python, programming

I've written many papers and a lot of web pages that includes source code. Since Python code was an important part of my Dr. thesis, I even wrote a tool to generate a pretty-printed Python code for LaTeX (this was written in 1997, but since I've been using it ever since it has had a few minor bug fixes since then; however, it needs Python 1.6 and it was the first Python program I ever wrote!). Jus …

Last updated: June 17, 2024

A suggestion for backup on Mac

January 8, 2014  |  os-x, tools

A lot of options for backup on your Mac exists. I use Time MachineBackblaze, Crash PlanTransporterCarbon Copy Cloner, and other tools for different types of backup on different Macs. The challenging backup for me are my pictures. I want at least one backup not in my house. The size of this backup is large, and since I am using Aperture, the meta-data of the file-system has to be preserved. L …

Last updated: January 8, 2014

Snowman shell prompt

April 6, 2013  |  tools

My new bash shell prompt:

Snow term

Matching the large amount of snow outside. A more detailed picture of the snowman:

Old snowman

Inspired by put a burger in your shell.

Last updated: June 17, 2024

Coding fonts

October 11, 2012  |  fonts, tools, programming

I consider myself a programmer, and to perform this task I rely on a set of tools. I need a text editor, compilers and/or run-times, build-systems, code repositories, documentation, and sometimes even an IDE. Since the late 80s my text editor of choice has been Emacs (and Aquamacs on OS X), but I am also comfortable with vi (including Vim) and ed. Currently, I am investigating time in newer text e …

Last updated: June 17, 2024

Generating a BibTeX file from Cristin data

October 8, 2012  |  web, publ, python

Based on the previous script generating HTML from Cristin data, I created another script generating a BibTeX file from the same JSON data. The script has the same limitations as the previous one, but it should be easy to modify for your needs. Have fun!

Last updated: June 21, 2024

Fetch and process information from Cristin

October 6, 2012  |  web, publ, python

Yesterday I wrote a small Python script to fetch and generate a publication list for web-pages. I use a web-services (ws) provided by Cristin (Current research information system in Norway). Cristin is a research information system for hospitals, research institutes, and universities and university colleges. From the provided ws I use the method hentVarbeiderPerson (see Brukerdokumentasjon Cristin …

Last updated: October 6, 2012