jekyll -> hugo
This commit is contained in:
commit
80b4614c0d
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "themes/papermod"]
|
||||
path = themes/papermod
|
||||
url = https://github.com/adityatelange/hugo-PaperMod.git
|
||||
16
content/post/2023-03-19-a-new-beginning.markdown
Normal file
16
content/post/2023-03-19-a-new-beginning.markdown
Normal file
@ -0,0 +1,16 @@
|
||||
---
|
||||
categories: update
|
||||
date: "2023-03-19T21:35:00Z"
|
||||
title: A new beginning
|
||||
---
|
||||
|
||||
Hello! :3
|
||||
|
||||
This is a new beginning of my blogging adventures.
|
||||
Maybe I'll find more time and be less lazy than last time.
|
||||
|
||||
Also, I got a fresh domain. (which looks very sus but idc)
|
||||
|
||||
New blog posts should be coming soon.
|
||||
|
||||
|
||||
28
content/post/2023-03-19-self-hosting-gitea.markdown
Normal file
28
content/post/2023-03-19-self-hosting-gitea.markdown
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
categories: coding
|
||||
date: "2023-03-19T22:13:00Z"
|
||||
title: Self Hosting Gitea
|
||||
---
|
||||
|
||||
Some time ago I decided I want to take matters into my own hands and host my own code.
|
||||
I was aware of a few git hosting services: GitHub, GitLab, BitBucket, and Gitea.
|
||||
|
||||
GitHub was no option, as you can't self-host that.
|
||||
|
||||
I was not very familiar with GitLab, and it looked clunky, big, and slow to me.
|
||||
|
||||
BitBucket I was not a fan of due to it being product of an Australian company. [See here why that might not be a good thing](https://fee.org/articles/australia-s-unprecedented-encryption-law-is-a-threat-to-global-privacy/)
|
||||
|
||||
Gitea seemed to fulfill all my needs - It's a fairly lightweight server, you can host it yourself, and it's FOSS.
|
||||
|
||||
The setup was fairly easy.
|
||||
|
||||
I even found a script that copies all your public (and private!) repositories from GitHub to your own Gitea instance - It doesn't get much better than that.
|
||||
|
||||
UX wise I must say I like it a lot - it might be "inspired" by GitHub more than a bit, but it makes for a very pleasant experience.
|
||||
|
||||
|
||||
If you want to check it out, [you can do that here](https://tea.x77.dev/explore/repos).
|
||||
However, please don't make this your space to store all your important repos - I do not want the responsibility to ensure other peoples stuff stays intact.
|
||||
|
||||
Nevertheless, I can recommend hosting your own git server, I definitely learned a thing or two more by doing so.
|
||||
84
content/post/2023-05-18-most-sane-language.markdown
Normal file
84
content/post/2023-05-18-most-sane-language.markdown
Normal file
@ -0,0 +1,84 @@
|
||||
---
|
||||
categories: coding
|
||||
date: "2023-05-18T11:07:00Z"
|
||||
title: My Favourite Programming Language
|
||||
---
|
||||
|
||||
As hopefully many people are aware, C and C++ have a notion of "Undefined Behaviour".
|
||||
Few people seem to realize what that means though, so I wanted to write a funny program to illustrate it.
|
||||
|
||||
Most people just seem to think that if Undefined Behaviour happens, then just some values might be random.
|
||||
However, I think it's much worse than that.
|
||||
|
||||
*At the moment I am using gcc version 13.1.1 20230429, so if you want to reproduce results I would recommend sticking to that (or very similar) compiler versions.*
|
||||
|
||||
---
|
||||
|
||||
Let's get started then!
|
||||
One of the simplest undefined behaviours in the C language family is integer overflow.
|
||||
Now one might think: if overflow occurs, the value of the variable that has overflow just isn't defined - however, that couldn't be further from the truth.
|
||||
|
||||
What the C compiler internally does, is that it *assumes* that undefined behaviour never occurs.
|
||||
What makes this dangerous is that those assumptions are then used to optimize your code.
|
||||
|
||||
Let me give an example:
|
||||
|
||||
{{< highlight c >}}
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int i = 0x40000000;
|
||||
printf("3*i has the value %d.\n", 3*i);
|
||||
return 0;
|
||||
}
|
||||
{{< / highlight >}}
|
||||
|
||||
Because integer overflow is a thing, this prints the following line:
|
||||
|
||||
{{< highlight txt >}}
|
||||
3*i has the value -1073741824.
|
||||
{{< / highlight >}}
|
||||
|
||||
|
||||
However, as mentioned before, the compiler assumes that this does not happen.
|
||||
And this is exactly the problem:
|
||||
|
||||
{{< highlight c >}}
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int i = 0x40000000;
|
||||
printf("3*i has the value %d.\n", 3*i);
|
||||
if (3 * i > 0) {
|
||||
printf("3*i is bigger than zero.\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
{{< / highlight >}}
|
||||
|
||||
Surprisingly, this snippet prints both lines!
|
||||
First, it prints the (negative) value of 3 times i, and then it claims that the value is positive!
|
||||
|
||||
That is due to a simple optimization of gcc that tries to prevent expensive conditional jumps, and so decides at compile time that multiplying two positive numbers is also positive - assuming integer overflow does not happpen.
|
||||
|
||||
|
||||
This can cause very funny (and hard to debug) errors, which is why C is sadly not my favourite language.
|
||||
I hope you learned something in this short blogpost :)
|
||||
|
||||
|
||||
{{< highlight c >}}
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void) {
|
||||
int i = 0x40000000;
|
||||
|
||||
int k1 = 3 * i;
|
||||
#define k2 3 * i
|
||||
|
||||
if (k1 < 0 && k2 > 0 && k1 == k2) {
|
||||
printf("totally sane language\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
{{< / highlight >}}
|
||||
47
content/post/2023-06-04-ssh-configs.markdown
Normal file
47
content/post/2023-06-04-ssh-configs.markdown
Normal file
@ -0,0 +1,47 @@
|
||||
---
|
||||
categories: coding
|
||||
date: "2023-06-04T10:00:00Z"
|
||||
title: a little ssh trick
|
||||
---
|
||||
|
||||
I finally took time to set up my SSH properly.
|
||||
Due to the nature of my setup, I needed to use non-default ssh ports.
|
||||
|
||||
Kind of annoying, isn't it?
|
||||
You have to specify the port ever time you connect, like so:
|
||||
|
||||
{{< highlight txt >}}
|
||||
ssh user@host -p port
|
||||
{{< / highlight >}}
|
||||
|
||||
Worse even, if you have multiple ssh certificates, you need to specify that as well!
|
||||
|
||||
|
||||
Luckily this problem has a very easy solution :)
|
||||
|
||||
|
||||
### SSH Configs
|
||||
|
||||
You can create a config file at ~/.ssh/config and save your frequent connected servers there.
|
||||
|
||||
For example, I have this entry in my config:
|
||||
|
||||
{{< highlight txt >}}
|
||||
Host homeserver
|
||||
HostName ssh.x77.dev
|
||||
Port 42069
|
||||
User brimbly
|
||||
IdentityFile ~/.ssh/homeserver
|
||||
{{< / highlight >}}
|
||||
|
||||
So instead of connecting with
|
||||
{{< highlight txt >}}
|
||||
ssh brimbly@ssh.x77.dev -p 42069 -i ~/.ssh/homeserver
|
||||
{{< / highlight >}}
|
||||
|
||||
I can just connect like this:
|
||||
{{< highlight txt >}}
|
||||
ssh homeserver
|
||||
{{< / highlight >}}
|
||||
|
||||
I hope this is news to at least one person, just found this out after years of using ssh (:
|
||||
@ -0,0 +1,41 @@
|
||||
---
|
||||
categories: null
|
||||
date: "2024-01-20T16:00:00Z"
|
||||
title: Customize your Firefox Search
|
||||
---
|
||||
|
||||
Recently I have been plagued by search results polluted by low-quality and/or uninformative results.
|
||||
One website annoys me in particular, which I will refer to as *mediocre.com*.
|
||||
Hence, I would like for these articles to never appear in my search results again.
|
||||
|
||||
---
|
||||
|
||||
Firefox luckily allows you to configure your search, but it is not as user-friendly as one might hope.
|
||||
|
||||
First we need to allow custom search engines at all:
|
||||
- Go to `about:config`
|
||||
- Search for the key `browser.urlbar.update2.engineAliasRefresh`
|
||||
- Set it to `true` (you might need to create it if it does not exist already)
|
||||
|
||||
Next, we need to obtain our search template.
|
||||
- Search for `dummy -site:mediocre.com` using your favourite search engine
|
||||
- Get the URL from the search result page (in my case `https://duckduckgo.com/?q=dummy+-site%3Amediocre.com`)
|
||||
- Replace `dummy` with `%s` (in my case `https://duckduckgo.com/?q=%s+-site%3Amediocre.com`)
|
||||
|
||||
Then, we can add this as a custom search in firefox.
|
||||
- Go to `about:preferences#search`
|
||||
- Under `Search Shortcuts` click `add`
|
||||
- Fill in all the info
|
||||
* the name is not very important
|
||||
* Engine URL would be `https://duckduckgo.com/?q=%s+-site%3Amediocre.com` for me
|
||||
* As Alias I chose a period (`.`)
|
||||
|
||||
Optionally you can make that the default search engine. There, just select whatever name you gave it previously.
|
||||
If you don't want to use your custom search every time, you can begin a search query with the alias you chose previously to make firefox use the template for that particular search.
|
||||
|
||||
---
|
||||
|
||||
I will now happily never see annoying articles anymore.
|
||||
I thought it would be useful enough to share :)
|
||||
|
||||
Enjoy!
|
||||
4
hugo.yaml
Normal file
4
hugo.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
baseURL: https://log.x77.dev
|
||||
disablePathToLower: true
|
||||
languageCode: en-us
|
||||
title: x77 blog
|
||||
1
themes/papermod
Submodule
1
themes/papermod
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 3f50861a0ced88f9b614a43662edeb4c0bc45da8
|
||||
Loading…
x
Reference in New Issue
Block a user