Skip to content

Instantly share code, notes, and snippets.

@alifeee
alifeee / factorio-map-hosting.md
Last active January 30, 2024 23:23
Factorio map hosting
@alifeee
alifeee / parse_toggl.sh
Last active February 1, 2024 01:43
Toggl Track API JSON to CSV conversion
#!/bin/bash
# turns Toggl JSON API data into CSV format
# currently ignores any array fields
# you can override the TOGGL_KEYS env variable to set which keys you want in the CSV
# usage
# get toggl data
# https://developers.track.toggl.com/docs/api/time_entries/index.html
# curl https://api.track.toggl.com/api/v9/me/time_entries -H "Content-Type: application/json" -u <email>:<password> > toggl.json
# curl https://api.track.toggl.com/api/v9/me/time_entries -H "Content-Type: application/json" -u <api token>:api_token > toggl.json
@alifeee
alifeee / how-to-blog.md
Last active April 21, 2024 23:52
how to create a blog?

How to start blogging

You might not think you should blog. I think you should.

I like your thoughts! I want to be able to read them!

Here are some other reasons:

@alifeee
alifeee / common-rss-URL-extensions.md
Last active January 31, 2024 17:07
Common RSS URL extensions

Common RSS URL extensions

I like blogs. I like RSS feeds. Often, blogs don't have an RSS feed link. Often, these blogs do have an RSS feed, thanks to whatever site generator they use.

Thus, I like to try and find the hidden feed. These are the URLs I usually put on the URL to try and find the feed.

For example, blog.alifeee.co.uk -> blog.alifeee.co.uk/feed.xml

/feed
@alifeee
alifeee / ubuntu-run-as-a-service.md
Last active February 7, 2024 22:26
How to run things as a service

How to run things as a service on Ubuntu

I run things on my server. I'd like to run them in the background, so they restart when the server restarts.

I was running them "in the background" with tmux, which I had to set up again every time the server restarted. This was annoying. So, here I run them as a service.

I had a vague knowledge of services, because some things I use are one, like nginx and murmur for mumble.

Firstly

@alifeee
alifeee / squarespace-RSS-combiner.sh
Created February 8, 2024 15:15
Squarespace RSS combiner
#!/bin/bash
# combines SquareSpace RSS feeds
# Squarespace default feed (e.g., https://www.treehousesheffield.com/events?format=rss) only returns the current month
# This script fetches the current month and the next two months and combines them into a single RSS feed
# The script is intended to be run as a cron job
# It should work for any SquareSpace site (assuming they use the same query variable format)
# usage e.g.,
# ./combinerss.sh https://www.treehousesheffield.com/events?format=rss > /var/www/html/treehousesheffield.com/events.rss
# get today month and year
@alifeee
alifeee / gpl-to-css.sh
Created February 29, 2024 16:36
Convert GIMP's `.gpl` file to CSS variables
#!/bin/bash
# convert a Gimp colour palette (.gpl) to a list of CSS variables
# example:
# ./gpl-to-css.sh my-palette.gpl > my-palette.css
# converts
# ----- my-palette.gpl -----
# GIMP Palette
# Name: My Palette
# Columns: 3
# 255 0 0 Red
@alifeee
alifeee / woff-to-css.sh
Created March 8, 2024 02:18
Convert a font (`.woff` or otherwise) filename to CSS classes
#!/bin/bash
# converts a font (.woff) filename to a CSS @font-face and class-selector based on filename
# example:
# ./filename_to_css.sh "path/to/my-font.woff"
# with multiple files
# find path/to/fonts -name "*.woff" -exec ./filename_to_css.sh {} \;
# get name from regex match
name_regex='\/([^\/]*)\.woff$'
if [[ $1 =~ $name_regex ]]; then
@alifeee
alifeee / bash-graphs.md
Last active March 15, 2024 18:54
Plot graphs using the terminal (bash)

Bash Graphs

Plot graphs using the terminal. E.g.,

> cat sensor.txt | awk -F ':| *' '{print $2}' | eplot -d -t CO2 2> /dev/null

  4000 +-------------------------------------------------------------------+
       |         +      +.+.+       +         +         +        +         |
       |                :    .+                                CO2 +.....+ |
@alifeee
alifeee / ruby-and-jekyll-on-linux.md
Created March 14, 2024 20:24
How to use Ruby and Jekyll on Linux

Using Ruby on Linux

Install Ruby + Gems

sudo apt-get install ruby-full
gem install bundler
bundle config set --local path 'vendor/bundle'
bundle install