Email is great. It is a time tested standard, reliable, and federated. Today I spent some time cleaning up a couple scripts I have regarding email. Ever since I set up my own server with mailinabox.email/, I have been scripting some IMAP and SMTP things. It is much easier to do things with a custom server than with a large email provider like Gmail since you don't have their proprietary system on top of everything. The scripts reside in this repository.
This file handles all the shared code regarding IMAP and SMTP, like sending and parsing the inbox. I did not have this before today, and foolishly was just copying the send mail method in every script. In refactoring this, I accidentally sent out an email about an old post to all the subscribers on my website from the email sign up (sorry about that). I'm not quite sure how old this post was, as I don't show years for some reason in posts, which is something I need to fix.
Manages the config file for everything. If no config file exists, it will prompt you to create one with a creation tool.
This script is fairly specific, and it checks if there is a new post on my website and if so sends out the email. Most of this code is DB logic, since that's where the information for when the last email was sent is kept. I run it in crontab, and so emails are send when my server hits midnight.
This is where things begin to get a bit interesting. I set up this script to send an email starting with the subject "REMINDER: " with the rest of the subject and body coming from the command arguments. This makes it really easy to set up a crontab line with the script for things like "pay rent near the end of the month" or "backup computer on the 5th". I can see the email in my inbox when it comes, and it is a reminder to do that thing.
This script does the most, and I run it every day. First, it will check my inbox for any emails that contain "REMINDER" in the subject and include their subjects in a list, just so the unread emails don't get buried in my inbox. Next, it will go to the Library of Congress newspaper archives to find a newspaper from 100 years ago and if there is one it will appear also in the email. I find old news to be fascinating, and in the future would be interested in including some more "this day in history" features. Lastly, this script will also include a detailed weather forecast table. I have more ideas of things to include, and I am excited to extend this daily email with even more things.
Sun Sep 20 100days dev 👍 (0)
A while back I wrote local-podcast-generator as an Android app. It is just a fork of a simple http server that generates an RSS feed for the files in a given directory. There are a few more things I need to work out in it before it is fully released.
You give it a directory on your phone, and it creates a podcast feed based on the files in that directory. You can take that feed and add it to your favorite podcast player. It does not recursively explore down the file tree.
Let's say you have a series of audio lectures or audio books downloaded to your phone. You've tried to listen to them in a media player, like VLC, but this isn't optimal. Media players don't keep track of which episodes you have listened to, and they can lose your place. If you take time off from listening, you can come back to your podcast player and pick up right where you left off. Podcast apps are designed for this type of long form, episodic audio content.
I've tried to listen to librevox audio files in VLC, but it really is just inferior to a podcast app. That's why librevox offers rss feeds for their audio books. But some of my audio content comes from CDs, and so feeds don't exist for them. Hosting them as an RSS feed seems to be overkill, and would require you to download them over network. Running the podcast generator app keeps everything local.
Get the apk release from here. You should hopefully be able to install that (I'm still figuring out how to build and distribute apk releases, so let me know if there are any issues).
Wed Sep 02 100days dev 👍 (0)
I finally have released my final project from last semester for my Programming Verification and Synthesis course. I made a frontend for it so it can be used as a web app. (Please be kind with any requests, as it can take a while per each one). The idea is to take a segment of code, and replace it with a shorter one, along with some method declarations.
The first box is (restricted) java code. Keep to one statement per line, and don't use the compound assignment operators (+=, etc). Avoid for loops and instead use while loops. All variables must be int types, and do not include declarations within the code segment.
The second box is the set of variables (comma seperated) to check for equality on. After refactoring, the new code will ensure these variables are the same as in the original. By contrast, not all variables may be important after the code body, and so their equality does not matter.
The third box is the set of java classes that may be used (comma seperated). Works best at calling static methods. There is no way to use a custom class as of now, so you are limited to the standard Java API.
The fourth box is any delcarations to make for variables. These are variables that should not have values prior to the code segment.
After clicked refactor, a new body of code will be generated that is equal (ideally) to the original code.
Check it out here: https://refactoring.marks.kitchen/
Thu Mar 12 dev 👍 (0)
Before the fall is officially here, I want to send an update on some stuff that I've been up to. In August, I participated in my first ever game jam. It was also my first real game that I made, other than some small arcade-ish games. The game is called Cosmic Cargo, made over a week with a team of (mainly) 2 developers, 1 sound artists, and some others helping with testing. The game is based on Oregon Trail, but in space. You can check it out here. I had a lot of fun making the game and I want to participate in more jams in the future. I also recently moved and started my PhD in computer science. It has been great so far, but also very stressful adapting to a new environment. The CS department here alone has more students than the total at my last school. I created my own budgeting app, which is just a glorified literal spreadsheet. I wanted an easily enter purchases I made into a spreadsheet, but my problem was that editing a sheet on a phone is not fun. So I made a short app that takes the data I want as simple inputs, allowing it to do some data validation and automatically input things like the date. The app then can use the share function to send an email with the content I entered to my gmail account. Emails sent from this app are parsed using google scripting into a spreadsheet. Ideally, I would not need to go through google to do this, but the process works well. The email traces also are a sort of backup too. Eventually, I want to easily add a photo of a receipt too in the app, but my first attempts at doing this were not so easy. Hopefully, some of you received this blog update through email. I have been meaning to set up a newsletter infrastructure with this website and more regularly update it as well. For now, I'll alert the email list that there is a new post at least. If you wish to be added to this, you can sign up here
Thu Sep 19 blog dev update 👍 (0)
It has been a while since I last posted, but the summer has kept my busy. I've had many issues with HTTPS on my website, and have resolved to temporarily disabling it so that the HTTP version is still available at least. The biggest project I've worked on since my last update has been my Telegram Arcade. I use the Telegram messenger a lot, and one feature that is fun about it is the HTML5 game support. There is incredibly little about this online, I haven't found anyone posting about using this API. After spending a few hours with it, I found it incredibly frustrating, but I got it to work and have tried to make it easier for others to use it as well. A user well sent an inline message to your bot in the form of @ . Your bot will tell Telegram what games to show to the user. They will select one and Telegram sends a message in chat with a link to play that game. By clicking the play button, a request is made to your bot for a URL to play this game, and then the user is redirected to that URL. Your game must communicate with your bot to set the player's score. When a score is set by your bot, Telegram will display it in the chat. My Telegram Arcade tries to take away all the hard work from setting this up. Telegram Arcade is both a telegram bot and a web server for HTML5 games setup in the same directory as the bot. Currently, it has a basic snake game and a stacker game. These games make an HTTP request back to the web server to update the score, but other than this the HTML files are just pure JS canvas games. I had a fun time getting this to work, and while the games I made with the bot are not great, they are a good proof of concept. I hope to get more games on the Telegram API, currently the only games I know of on the platform at hosted by @Gamee and @Gamebot.
Sun Jun 09 blog dev telegram 👍 (0)
(disclaimer, marks.database is not an actual website)
I used to keep text files, tracking movies, books, my music collection, and various long term to do lists. Last year, I transferred some of this information over to a MySQL database, managed with a couple python scripts that just wrapped MySQL commands. It was fairly clunky though, and pretty limiting too. Even php myadmin would've been easier. So recently, I created marks.database, which is a node front end for my specific database needs. It manages those things listed above. Additionally, I have created a meal planner section, which allows me to store the items in my pantry and combine them into recipes.
The program is built on node with vue and sequelize. Not much else is really needed. The CSS is fairly brief, though I might expand it later. Currently, it is just locally run, so performance isn't a big deal. Each update sends back the whole table.
There are some other things that should be improved about this project. I mentioned that it is running locally. The only requests it accepts are ones from the local IP. This might be a security flaw, and I could instead include an authentication scheme. The project should be organized better too. Each table should be a separate page, but instead it just hides all the non current tabs.
Working on marks.database taught me a little about design too. Initially, everything was on one page, which quickly became too clunky. With such large datasets it's important to be able to sort and filter. At first, I had the fields to add a new item to a table at the bottom, which was annoying. Every time you added an item, the fields scrolled off the bottom of the screen. With sorted data, you aren't appending to the end, so it works just as well to include the input fields at the top too. Colors to differentiate rows in a table are important too, they make viewing much easier on the eyes.
I want to expand the database to be able to track my expenses. This will probably have to wait until this summer, where I might get some more free time to work on something like that. The meal planner system could work better too, it should be easy to add an ingredient to your shopping list for example. I also want to be able to sort movies by director, for example. I am happy with the progress that I have made so far on marks.database.
Sun Apr 07 blog dev 👍 (0)
While it has been more than one month in the making, for this month's blog entry I'll be talking about how I've pieced it all together. For the most part, it is a pretty standard node server using express, mysql, sequelize (ORM), and a little bit of vue. I originally wanted to have everything be a static webpage, but vue was pretty lightweight. I have considered switching to static webpage generators, but right now I am very happy with the development process.
I included bootstrap on the website for a while, but I decided against it. I wanted to have a unique look, and using bootstrap gave it that feel a lot of websites have. It wasn't hard to include a little CSS to do a few things I was using bootstrap for anyway. I want to keep the website pretty quick too, and bootstrap really added to the size of a page.
I set up an admin page that allows me to log in and post to a board. Currently there are bread, index, and blog boards. Right now I'm just posting plain text, with the option to attach images and also tags. I also have page with essays, which is static for now. I'm not sure how I want to organize this section, so I am focusing on other stuff for now. The admin page also collects some statistics about routes. I set a unique cookie when a user starts a session, and I track their requests to the server. The users IP isn't stored, keeping privacy in mind. I'm not doing too much with this data right now, but eventually I could get a better idea of what a user's session typically looks like, and how many sessions are started.
My goal in starting this website was to have fun. I thought that showing off stuff I baked would be a good excuse to make a website, and I have had a good time making one. It encourages me to build a cool website, and also bake delicious bread. I also want to write more, and this platform offers I good excuse to blog too. I'm going to try to get blog posts out monthly. I'd like to do weekly even, but I know that isn't likely right now.
Wed Mar 20 blog dev 👍 (1)