roytang.net Posts Photos Archives About

Subscribe: RSS JSON

2021 November

2020 January

2019 August

  • Back when I was still learning Python in 2008, one of the first "fun" scripts I wrote was a text generator using Markov chains. I'd run it against all the chat logs I had with people at work and serve the results from a webserver on my computer. THe results were often amusing and sometimes hilarious. Since I've been going through my old scripts lately, I thought I'd update that script to Python 3 (read: add parentheses around print params and use pathlib) and run it against all the posts on this here site. I added the script to my

    read more (162 words)

  • Ever since I started learning Python back in 2008ish, I've been using it as my primary scripting language for various tasks such as processing log files, organizing my own file system, processing stuff on this blog, and so on. A lot of it is basically moving files around. In the days of Python 2, that involved a lot of imports of different libraries like os, shutil and glob. It can become a bit messy with so many imports, and I often can't remember which import I need for a particular case and end up having to search for the documentation

    read more (316 words)

2019 February

2018 October

2017 March

2017 February

2017 January

  • So the other day I was reworking a Python script that I had been using for years on my home PC to manage and categorize some downloaded files for me. This time I wanted to add some smarter behavior to make it more able to figure out when to group files into folders without constantly needing manual intervention from me. To do this, I needed to persist some data between runs -- so that the script remembers how it categorized previous files and is able to group similar files together. Now since my software development career has largely been as

    read more (322 words)

2011 August

2010 October

2010 July

2010 June

2010 January

2009 December

2009 September