notes by alifeee profile picture tagged github (3) rss

return to notes / blog / website / weeknotes / linktree

here I may post some short, text-only notes, mostly about programming. source code.

tags: all (44) scripting (13) linux (5) bash (4) geojson (4) obsidian (4) android (3) github (3) html (3) jq (3) ............ see all (+63)

my de-googlification so far - switching from big tech # prev single next top

tags: software, ethical, big-tech, obsidian, email, syncthing, openstreetmap, linux, github, android • 1430 'words', 429 secs @ 200wpm

I think it's a great idea to use ethical alternatives to free software made by mega-corporations with profit-maximising motives.

To that end, I had a push to replace lots of things I used (most because they were the default, or because I'd used them a long time), mainly using the great website https://switching.software/ (I also know of https://european-alternatives.eu/alternatives-to but haven't used it as much.)

I replaced some things. I didn't manage to replace everything. Change is, and should be, incremental.

Here is a list, mostly copied from my notes, of what I replaced, and what I didn't. The title of each item is verbatim copied from my notes, and I have added context underneath each.

Google

Gmail -> see below
see "email" below
Drive -> Cryptpad/Nextcloud or Syncthing
I replaced my Google Drive usage with a weird setup where I use Syncthing to sync several folders between my devices, and to share large files I either upload them to my server (bad advice, technical knowledge needed), or I upload them to Wormhole where they get deleted after 24 hours. I don't have much need to share files for a long time, but I'd consider Nextcloud.
Photos -> ???
I thought about this a lot, but Google Photos is too good for me. Maybe another day.
Calendar -> ???
I installed Tasks and Fossify Calendar. I tried to use them, but in the end, Google Calendar won out, and I still use it.
Keep -> ???
I didn't really replace keep, I just started using it less. I put most of my notes in Obsidian, but I still have it installed. Sometimes, when I want to take a really quick note, I'll put it in there.
Maps -> OpenStreetMap
I still use Google Maps, but I've been using OpenStreetMap more recently, and while interrailing last month, I mainly used OsmAnd because of its great offline maps. Day-to-day, I still use Google Maps, because it has most-or-every business, and websites, and opening times, which OSM tries but just doesn't (yet…) have the data for.
generic Android apps -> Fossify
I found Fossify who make "generic apps" for Android like the gallery, file explorer, contacts, calendar, messages, notes, etc. I haven't used many of them, apart from the file explorer, which I like.

Facebook

Facebook -> delete it
my suggested replacement here was "delete it". I haven't. Sometimes I open it for "mindless phone downtime", but I have a 5 minute daily app timer on it, so not for long.
Instagram -> PixelFed
I tried to import my Instagram export into Pixelfed, but it wouldn't work when I deleted my DMs from the files (as these are not needed to import only posts). I raised an issue, and left it at that. Since then, PixelFed has gotten quite a lot more popular. I haven't tried again recently, but I find the main developer of PixelFed a little weird on Mastodon. That means nothing, but… I just haven't tried again.
Messenger/WhatsApp -> Signal
I am slowly convincing friends and group chats to move to Signal. It goes well.

Microsoft

OneDrive -> Cryptpad/Nextcloud or Syncthing
see Google Drive above. I have also stopped using OneDrive.
Windows -> Linux https://waldyrious.net/computefreely/
That site is good. This was probably the biggest switch in this list. I installed Linux in increments, first on my PC, then on my laptop, then on my Gaming PC, which ends up with Steam's Proton able to play anything I could have played on Windows! I'm loving it. I have Pop!_OS, backed up in a custom way.
GitHub -> sourcehut, codeberg, gitlab, etc
I haven't started on this one, even though I should. I have so many things on GitHub, and I feel as if I create a new repository every week. Combine that with all the GitHub actions I use, and I say rightfully that Microsoft has me. It's not what I want, but it's what I have.

Android

Android -> LineageOS or GrapheneOS or CalyxOS (comparison)
I looked into this one a lot, and talked to a few people I knew on Mastodon for advice. Ultimately, I discovered people's opinions and experiences that it was neat, but there were enough compatibility problems to be annoying. Particularly, that banking apps would semi-regularly break on non-stock-Android OSes, and that the banking app companies would say "we don't care". I use a very digital banking app where I only keep between £0 and £50 on my card, and it would be very annoying for me to not shuffle money around easily. I already have boneless Wednesday. I did enjoy installing LineageOS on an old phone though.

The rest

Notion -> Obsidian
Notion is classic lock-in. It was also a place where I had a lot of notes. I made an export, downloaded Obsidian (which, sadly, is still not open source - but your notes are simply text files, so I hazard if it were to go weird, there would be many Open Source pop-ups, or I could use VSCodium, etc.), and imported my export. It worked pretty well. Most files had double spaces where I only had single in Notion, and the databases ended up pretty weird (as loads of flat files), which made my Notion spider diagram look super weird. Anyway, I love Obsidian now. I sync my vault between my devices with Syncthing, and when there are editing conflicts, I use a great plugin.
Spotify -> https://codeberg.org/swiso/website/issues/26
Several months ago I was removed from a Spotify Family plan that I was on, so stopping my Spotify usage was pretty easy. I didn't resubscribe, and I mainly listen to the radio now (BBC Radio 6 Music ! the best station !). Sometimes, I miss being able to choose what I'm listening to. I tried to get SoundCloud, but it didn't have as much music on as I wanted (or it was restricted to a "super Pro" version). However, I do want it back. I might re-subscribe soon.
DNS Registrar -> https://dnsimple.com/ https://www.namecheap.com/ https://domainr.com/ https://www.namesilo.com/ (API) https://www.name.com https://desec.io/
to be honest, mine wasn't an evil corporation, I just wanted a new one (I was using 123-reg and it's super annoying to configure my DNS settings). It was difficult to web-search for this, and I ended up using Porkbun, which isn't even on the list above.

email

Format-break. I spent a long time looking at options, and ended up finding a bunch. Here was a list I had:

I wanted to use a custom domain (alifeee.net), I wanted to use wildcard domains (anyone@alifeee.net), I wanted to use maybe a few custom domains (alfierenn.dev), I wanted to use IMAP and SMTP (so I could view my emails with Thunderbird). Turns out those requirements were restrictive to make a lot of the above list bad options, which left me Proton or Mailbox.org.

There was a problem with Proton which I can't remember, so I am using Mailbox.org. I like it. Free your email.

The End

I started the push maybe six months ago. Maybe I did OK, maybe I didn't. But, I certainly made some changes, and I think that's good.

Why not take a look at https://switching.software/ and think about whether you are fine with the number of tentacles that American Big-Tech companies have in your life.

back to top

uploading files to a GitHub repository with a bash script # prev single next top

tags: obsidian, github, scripting • 364 'words', 109 secs @ 200wpm

I write these notes in Obsidian. To upload, them, I could visit https://github.com/alifeee/blog/tree/main/notes, click "add file", and copy and paste the file contents. I probably should do that.

But, instead, I wrote a shell script to upload them. Now, I can press "CTRL+P" to open the Obsidian command pallette, type "lint" (to lint the note), then open it again and type "upload" and upload the note. At this point, I could walk away and assume everything went fine, but what I normally do is open the GitHub Actions tab to check that it worked properly.

The process the script undertakes is:

  1. check user inputs are good (all variables exist, file is declared)
  2. check if file exists or not already in GitHub with a curl request
  3. generate a JSON payload for the upload request, including:
    1. commit message
    2. commit author & email
    3. file contents as a base64 encoded string
    4. (if file exists already) sha1 hash of existing file
  4. make a curl request to upload/update the file!

As I use it from inside Obsidian, I use an extension called Obsidian shellcommands, which lets you specify several commands. For this, I specify:

export org="alifeee"
export repo="blog"
export fpath="notes/"
export git_name="alifeee"
export git_email="alifeee@alifeee.net"
export GITHUB_TOKEN="github_pat_3890qwug8f989wu89gu98w43ujg98j8wjgj4wjg9j83wjq9gfj38w90jg903wj"
{{vault_path}}/scripts/upload_to_github.sh {{file_path:absolute}}

…and when run with a file open, it will upload/update that file to my notes folder on GitHub.

This is maybe a strange way of doing it, as the "source of truth" is now "my Obsidian", and the GitHub is really just a place for the files to live. However, I enjoy it.

I've made the script quite generic as you have to supply most information via environment variables. You can use it to upload an arbitrary file to a specific folder in a specific GitHub repository. Or… you can modify it and do what you want with it!

It's here: https://gist.github.com/alifeee/d711370698f18851f1927f284fb8eaa8

back to top

updating a file in a GitHub repository with a workflow # prev single next top

tags: github-actions, github, scripting • 196 'words', 59 secs @ 200wpm

often, I want to keep a file in a repository up to date using a script.

here is the most simple example of a workflow that does that, which could be placed in, e.g., .github/workflows/update.yml

name: update stock.txt

on:
  push:
    branches: ["main"]

permissions:
  contents: write

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: update stock.txt
        run: ./scripts/compute_stock.sh stocktaking.csv > stock.txt

      - name: Commit changes
        uses: stefanzweifel/git-auto-commit-action@v5
        with:
          commit_message: updated stock.txt with latest numbers

This workflow was created for https://github.com/lipu-tenpo/print-and-post to keep a file listing stock up to date with the "logs" of when I acquired and un-acquired stuff.

I initially thought about doing this using Git Hooks, but I want to be able to edit the "logs" from my phone or via a browser, where I wouldn't be able to trigger the git hook.

So, I'm doing it in a proprietary "GitHubby" way, which would be annoying to change if I changed to, say, GitLab. But, here we are. Technology lock-in is real.

back to top