YeenDeer softness blog (programming and electronics)

Ellie the Yeen is a soft YeenDeer that mweeoops and does programming

View on GitHub About Bots Projects Tags

The YeenDeer softness blog

Hi this is the blog of a YeenDeer mostly about programming and similar topics
  • RSS feed using Liquid

    Even if jekyll-feed is something you do have if you have a GitHub pages site there are many cases where you do want to be able to make your own RSS feeds. Such cases can be that you have very different categories that would not make sense to have the same feed for or you are using another templating engine such as Jinja which has an almost identical syntax or maybe even PHP and want to know the gist of how you would make a feed there. We are only however focusing on Liquid specifically in this article.

  • Generating share buttons using Liquid

    Liquid is a powerful templating language even if it is a non evaluating one. In the past we made some Share buttons using all the data we had gathered from various websites about how they use URLs for their share dialogs. What we can do with this data is generate share buttons in a fancy and easy way using Liquid.

  • Dynamic favicons

    Did you know that favicons on websites can be dynamic? You probably do since they are everywhere to display notifications on social media sites. We are going to look at how that is done and then implement it ourselves. At first we are going to look at a practical example of how it can look like.

  • Browser extensions and userscripts

    It is very easy to make browser addons for Chrome and Firefox. It has a simple and concise JavaScript API that is almost identical between them. You can always look at the API reference for Chrome and Firefox if you have no idea what to do.

  • Git for absolute beginners

    Git is a version control system that allows you to have files stored in specific versions then compared, updated or restored and various operations related to the history of the file and any changes. This is what a version control system does. You can have multiple branches too which is different versions of the files which is good for when multiple users work on something that then gets merged into the main branch.

  • Share dialogs and buttons

    On many websites there are buttons to share an article to other sites or to chat services. This is done in the browser either by linking to the website and passing parameters about the post to share or a protocol handler might be used when there is an actual application installed. In the case of email for mailto links it is really any mail that has it registered. We are going to look at different sites dialogs and how the link is constructed.

  • Automatic Git commit templates generator

    Git has a feature where you are able to set a template message for every commit you do by specifying a file either in config or as a command line argument. This might not seem as useful on its own as it is a static message that appears every single time as a base for your commit message and does not allow any variables. There is however a thing you can do in order to change that.

  • Making a Discord systemd failure handler

    Did you know that systemd allows you to create special units that run only when other units fail and that they can be used to send notifications when services go down. Now we are going to look at how that would be done using Discord using Webhooks. In the screenshot below is an example of a message generated using this method that uses a Discord embed with a custom profile picture.

  • OpenGraph and oEmbed. Who? What? Why? When? Where?

    So when you paste a link into a social media site or a chat app a certain thing tends to happen. The app sends a bot to the site in order to look at it and see what it is and if it is a picture maybe they will display it too you and the others in chat and if it is a HTML page it will find some meta tags and similar data in order to give you a preview in chat for everyone to view.

  • How to subscribe to all GitHub events through WebHooks

    So you might have noticed that on every repository on your GitHub you are able to put a webhook url that gets called whenever an event happens. To put a webhook on every project and then put on every new project can be an annoyance and what if I told you there is a way to subscribe to every single repository event on your GitHub projects?

  • Mastodon comment section on GitHub pages

    So you want a comment section on your blog on Jekyll but as it is static you cannot do any server side processing at all and you have to rely on Disqus or a similar service. Another thing you can do it make your own comment section using Mastodon since it tends to have a very open API with Access-Control-Allow-Origin: * which means that JavaScript in a browser can access the data. This is something that has been done by quite a few like here and here so it is not an entirely new concept but it is a useful one.

  • Useful command line aliases

    There are quite a bit of useful aliases you can have on your command line in order to do many useful things. Having aliases makes using the shell much easier and if you have any command that is hard to remember or write I really recommend to add it to aliases since then you will have a way easier command line experience. Here are some of the aliases I use on my command line that gets sourced in ~/.bashrc and ~/.zshrc

  • Compact exception printing in Python

    So recently I had the problem of something throwing exceptions and it was like really long exceptions that went way over 4 kilobytes of text which was hard to find something useful inside. So what was needed is something that made the exceptions much easier to see and to know the messages and the type rather than the 20+ files the stacktrace went through. At first this was a tough problem that maybe the stacktrace maybe had a solution to until the following was discovered. Apparently Python exceptions have two different attributes called __cause__ and __context__. What they do is they tell you what the previous exception was but they are slightly different. __cause__ is only set if there was something like

    raise ValueError("Something wrong") from e
    

    while __context__ is always set as long as a previous exception is there and otherwise it will be None.

  • GitHub profile and other special repositories

    GitHub has 3 special repositories each user or organization can have which does special things if created. The 3 of these are username that should have the same name as your username, .github and username.github.io where username should be your username in lowercase. These have various useful features that are very useful if you use GitHub a lot.

  • Add your own search engine in your browser

    Have you ever seen that you are able to second click on the address bar on website and wondered why there is a menu to add something? What you will be adding if you press yes is that you are able to have a search engine that pops up in the address bar if you click on it. When you have several search engines added you can hold alt and press the up and down keys to switch what search engine you want to use for the current search. What is also good to know is that you can write something short called a keyword then press space or sometimes tab and it will select that search engine and then you can enter your term and search with it.

  • Making a sitemap XML in Liquid

    Decided to make a simple sitemap generator using Liquid that is a part of jekyll. it is a template language that lets you do quite a few things like you can generate quite a few different data formats using it and it supports iterations and variables and such.

  • Posting on Mastodon with GitHub Actions

    So you might wonder if GitHub Actions can be used to make posts on Mastodon for simple bots such as to do stuff like maybe you want a Mastodon comment section or something like that and do not want to manually have to add the ids or store them externally.

  • The mysteries of the web root

    There are many files in the web root folder that is used for many different things that are often automatically grabbed by either bots or your browser. Here is a list of various things I have used and read about.

  • Open graph tags for SEO and social media optimization

    Have you ever seen links posted on social media where you get a preview of the content of the website that you link and wonder how that is made. It is done using certain HTML tags that a bot fetches when you link the webpage. This is of course subject to the robots.txt in the web root as most bots tend to follow that when fetching content. Below is an example of how that can look like.

  • Adding comments and upvotes to your blog using Disqus

    So you have a website and you are using a static website generator like jekyll or you do not want to make your own comment section due to the security issues it can cause. What you can do then is use a service like disqus in order to present a comment section inside an iframe. This is one among other solutions to provide a comment section for your blog. There are of course also other ways like Facebook has a thing where you can add a comment section using it. There are also some fancy unusual solutions like using a certain Mastodon post as a comment section which I read about when I searched for another post about how to make a Mastodon share button and both of these posts are extremely interesting and I recommend reading them.