Skip to content

Commit

Permalink
advanced github
Browse files Browse the repository at this point in the history
  • Loading branch information
mbund committed Dec 17, 2024
1 parent 5ebfdb0 commit f0f5171
Show file tree
Hide file tree
Showing 13 changed files with 639 additions and 3 deletions.
Binary file added public/assets/advanced-github/artifacts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/advanced-github/bctf-actions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/advanced-github/exemplary.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/advanced-github/linguist-bar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/advanced-github/packages-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/advanced-github/packages.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/advanced-github/permalink.webm
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/advanced-github/vscode.webm
Binary file not shown.
Binary file modified public/assets/cicd-for-university/pr-preview-action.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
636 changes: 636 additions & 0 deletions src/content/blog/advanced-github.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/content/blog/cicd-for-university.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ The goal is not to catch every error with the automated linter. Some rules are f
You know the drill by now. Let's make a GitHub Action. However, now we're dealing with C. This is not a write once, run anywhere kind of language (though it does run on _more_ than 3 billion devices). If `gcc` generates any warning, I get an immediate 0 on the lab. We're not dealing with peanut stakes here.
The required environment for the course is to write and run C code in `stdlinux`, which is just a server to `ssh` into that is hosted by the university. I prefer the development environment on my own machine, so I need to ensure that I am using the same compiler toolchain as the graders will be using. However I use NixOS, so binaries from other distros don't exactly just _run_. And I want the same environment in CI too. So I did the obvious thing and made a quick [docker container](https://github.com/mbund/stdlinux-compat/blob/main/Dockerfile) which is just pulling from the same version of linux that `stdlinux` is running, namely `centos:7.9.2009`. Then it installs `gcc`, `make`, `zip`, and a few other tools needed to build.
The required environment for the course is to write and run C code in `stdlinux`, which is just a server to `ssh` into that is hosted by the university. I prefer the development environment on my own machine, so I need to ensure that I am using the same compiler toolchain as the graders will be using. However I use NixOS, so binaries from other distros don't exactly just _run_. And I want the same environment in CI too. So I did the obvious thing and made a quick [docker container](https://github.com/mbund/stdlinux-compat/blob/main/Dockerfile) which is just pulling from the same version of Linux that `stdlinux` is running, namely `centos:7.9.2009`. Then it installs `gcc`, `make`, `zip`, and a few other tools needed to build.
By the way, the `stdlinux-compat` docker container I made is itself using a GitHub Action to build a `Dockerfile`, and publishes the image to `ghcr.io` (the GitHub Container Registry) so I can pull from it later.
Expand All @@ -262,7 +262,7 @@ At OSU you have the option between 3 group project courses as a Junior. Web dev
### Argentblua
On my laptop I run Fedora Silverblue, an atomic linux OS. The game design class is in C# with [Monogame](https://monogame.net). The recommended IDE is Visual Studio. This is a problem. Fortunately Monogame has instructions for install on Linux, though only for `Ubuntu 20.04`. No consideration has been given to Fedora, much less any immutable variant...so we're going to wing it. All we need is the dotnet toolchain, and some GTK libraries. I whipped up a [Nix](https://nixos.org) flake for it and...it didn't work. There is a special app called the MonoGame Content Builder which is required to bundle assets. It is configued with hard coded paths to look for fonts in. So, to package it for Nix would require patching. Instead, I just gave up and made a regular Fedora [Toolbox](https://github.com/containers/toolbox), installed dotnet and all the dependencies, and put vscode in it and just launch that vscode instance when I need to do work.
On my laptop I run Fedora Silverblue, an atomic Linux OS. The game design class is in C# with [Monogame](https://monogame.net). The recommended IDE is Visual Studio. This is a problem. Fortunately Monogame has instructions for install on Linux, though only for `Ubuntu 20.04`. No consideration has been given to Fedora, much less any immutable variant...so we're going to wing it. All we need is the dotnet toolchain, and some GTK libraries. I whipped up a [Nix](https://nixos.org) flake for it and...it didn't work. There is a special app called the MonoGame Content Builder which is required to bundle assets. It is configued with hard coded paths to look for fonts in. So, to package it for Nix would require patching. Instead, I just gave up and made a regular Fedora [Toolbox](https://github.com/containers/toolbox), installed dotnet and all the dependencies, and put vscode in it and just launch that vscode instance when I need to do work.
### Simple CI/CD
Expand Down
2 changes: 1 addition & 1 deletion src/content/blog/python-isnt-easy.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Traceback (most recent call last):
libvirtError: Failed to connect socket to '/var/run/libvirt/libvirt-sock': Permission denied
```

Any function can throw anything. So your only option is to wrap every function call in a `try:` `except:`. This is certainly possible, but in practice I've never seen it. The better alternative to `try`/`catch` is errors as values. Basically, in the return of the function signature, the possible errors are notated. Callers of the function are forced to lift out the value, and _at least_ acknowledge that an error is possible. There are some functions which don't throw errors, which is great, and we know that because it isn't in the function signature. In Rust, this is a `Result<T, E>`, in Go this is a `error` and the classic `if err != nil {}`, and in Zig this is a `!T`. Python has no equivalent, so I cannot in good faith recommend it as a language for production.
Any function can throw anything. So your only option is to wrap every function call in a `try:` `except:`. This is certainly possible, but in practice I've never seen it. The better alternative to `try`/`catch` is errors as values. Basically, in the return of the function signature, the possible errors are notated. Callers of the function are forced to lift out the value, and _at least_ acknowledge that an error is possible. There are some functions which don't throw errors, which is great, and we know that because it isn't in the function signature. In Rust, this is a `Result<T, E>`, in Go this is an `error` and the classic `if err != nil {}`, and in Zig this is a `!T`. Python has no equivalent, so I cannot in good faith recommend it as a language for production.

Also, here's a fun question: What is the difference between `my_func` and `my_func_2` below?

Expand Down

0 comments on commit f0f5171

Please sign in to comment.