Add posts from my old blog

This commit is contained in:
Anthony Wang 2022-05-20 14:49:17 -05:00
parent a6de4f5636
commit 9e7ae3dfd8
Signed by untrusted user: a
GPG key ID: BC96B00AEC5F2D76
16 changed files with 669 additions and 0 deletions

View file

@ -0,0 +1,39 @@
---
title: "Best CLI Tools"
date: 2020-12-24
draft: true
type: "post"
tags: ["Random", "Linux"]
---
*Originally posted on my [old blog](https://git.exozy.me/Ta180m/blog/src/branch/main/_posts/2020-12-24-best-cli-tools.md)*
# `tldr`
The. Best. Documentation. Tool. Ever. Seriously. Instead of pulling up a web browser, searching for the command, and scrolling through pages of documentation, you can instead use `tldr` to get most common use cases for a command. Sure, maybe 10% your particular use or flag won't be on there, but it's a great quick-and-dirty way to get a refresher about unfamiliar commands.
![`tldr 7z`](/blog/assets/tldr-7z.png)
# `fzf`
Like `find` but better and more powerful. For instance, `pacman -Qq | fzf --preview 'pacman -Qil {}' --layout=reverse --bind 'enter:execute(pacman -Qil {} | less)'` will start up cool two-panel search for your (Arch) system's packages. And that's just the tip of the iceberg; there's so much more you can do with `fzf`
![`pacman -Qq | fzf --preview 'pacman -Qil {}' --layout=reverse --bind 'enter:execute(pacman -Qil {} | less)'`](/blog/assets/tldr-fzf.png)
# `convert`
No need to upload your images to sketchy websites who could steal your data in order to do image conversions. Imagemagick's `convert` tool has got your back. It's just `convert image.jpg image.png`, or you can also throw in some flags to resize the images and do other kinds of manipulation. It's magic! Or should I say "magick"?
![`convert`](/blog/assets/tldr-convert.png)
# `last`
Ever wanted to know your system's installation date, or even better, the full history of shutdowns and reboots? Well, `last` can help. Typically found in the `util-linux` package, it will faithfully log every boot and shutdown. According to `last` my system was "born" on Thursday September, 3rd 22:18:55 2020. Great to know, so I can celebrate its cake day next year!
![`last`](/blog/assets/tldr-last.png)

View file

@ -0,0 +1,64 @@
---
title: "The End of the OS Wars"
date: 2021-06-22
draft: true
type: "post"
tags: ["Windows", "Linux"]
---
*Originally posted on my [old blog](https://git.exozy.me/Ta180m/blog/src/branch/main/_posts/2021-02-15-end-of-os-wars.md)*
**Warning**: Really long and disorganized post ahead. Half of it was written in October 2020 and the other half in February 2021, so that should give you an idea about how bad this post is. You should probably skip this one.
According to open-source advocate Eric S. Raymond, the end of Windows may be in sight. A few days ago, on his blog, he posted a [very thought-provoking article](http://esr.ibiblio.org/?p=8764) about the future of Windows and Linux. So that got me thinking: what does the future look like?
There are basically three possibilities for the future:
1. Linux overtakes and dominates Windows in market share, perhaps from Microsoft adopting the Linux kernel as what Raymond suggested.
2. Linux stays at around its current market share forever. It seems to me that the current situation isn't exactly a very stable equilibrium, but hey, Linux has been roughly in the same zone for at least 15 years, so maybe this could continue indefinitely.
3. Linux market share on the desktop asymptotically approaches zero and becomes a hobbyist OS (again). Unlikely, since there seems to be a pretty healthy community of people supporting it right now. MacOS has always been taking away a chunk of would-be Linux users, and since it's gaining market share, that could be a bad thing for Linux.
## Case 2
We're going to start with possibility 2, since it mirrors the present the closest. What's preventing Linux market share from increasing beyond the already-impressive 2-3%? Two things: preinstalled hardware and apps.
Manufacturers are definitely pumping out more Linux computers these days, with the big brands like Dell and Lenovo in the game now. Linux market share has also been slightly increasing, and this may be a possible contributor. Preinstalled hardware provides much more benefits than just the obvious now laypeople don't need to bother to do the installation themselves. But also, manufacturers are not going to sell you broken hardware that doesn't work with Linux; they're going to at least but the bare minimum effort the make sure it works decently. Maybe it won't be Windows-level (which is a pretty low bar to pass, since many OEM drivers are horrendous), but it'll be better than now, where hardware incompatibilities and issues still plague the Linux world. I have a friend who tried out Kubuntu, but guess what? His laptop and Kubuntu didn't really get along well, so, back to Windows 10!
What about apps? The state of Linux apps has come a long way in the past few years, with the rise of distro-agnostic packages like Snap (the chaotic one), Flatpak (the lawful one), and AppImage (the neutral one), the ([evil](https://medium.com/@boundarybreaker/electron-is-a-hulking-monstrosity-of-a-wora-framework-and-it-needs-to-be-replaced-25e9d849b0e)) Electron framework, improvements in [Wine](https://www.winehq.org/announce/6.0) and [virtualization](https://github.com/Fmstrat/winapps), and other stuff that I'm too lazy to list. But there's still some noticeable gaps: Microsoft Office (there's a [quite bad (what type of bracket to use for triply nested parentheses?)] web version), Adobe stuff, and pro audio and video production apps. Yes, there's LibreOffice and GIMP, but repeat after me: LibreOffice is not Office and GIMP is not Photoshop. And don't get me started on the absolutely disgusting fragmentation of the wild west of Linux distros. It's downright terrible. Terrifying. That's why Snap and friends are a thing, and address this problem to varying degrees of success. But having a package manager is a pretty nice tradeoff!
So can these things stay in this quasi-stable equilibrium? Maybe. It's been over 15 years like this, and it's not hard to extrapolate this into the future. OEM Linux computers might stay a dev thing indefinitely. Adobe Photoshop could never get ported. But what about the other cases?
## Case 3
Oh, the terror, shriek the Linux fans! Some have predicted the [downfall of Linux](https://www.dedoimedo.com/computers/linux-beginning-of-the-end.html), and it's not too fun to imagine. If there's one threat to Linux market share right now, it's probably macOS. There are 100 kinds of people out there: those who could use Linux and do, those who could use Linux but don't, those who can't use Linux in its current state or would otherwise have a hard time, and those who don't know binary. Anyways, we aren't going to touch on the first case for obvious reasons. The second one is much more interesting: there are a lot of developers out there who actually prefer macOS or even Windows. (How could they, shriek the Linux fans! I know, it's awful.) And devs are the perfect people to try to convince to switch to Linux, since they usually having the technical aptitude and attitude to learn and use Linux. (Basically, if you have the aptitude to use `aptitude` [the package manager frontend], I'm throwing you into the category of people who could use Linux) And macOS market share is, *shudder*, rising. Pretty fast, actually. And macOS has all sorts of real advantages over Linux, such as hardware that's guaranteed to work and decent app support due to its fragmentation of exactly one "distro". Of course it comes with its own hulking share of issues as well, but a lot of people either don't know or don't care about these things, whether it's [telemetry](https://www.dedoimedo.com/computers/telemetry-should-you-allow.html) or [vendor lock-in](https://en.wikipedia.org/wiki/Vendor_lock-in). So yeah, if you want to use macOS, do it in a [VM](https://github.com/kholia/OSX-KVM). I personally find this case pretty unlikely, given the sheer volume of existing Linux users, as well as the fact that Linux is always at the forefront of innovation on the desktop, whether it's virtual desktops or app stores. Microsoft and Apple are basically monopolies and they don't need innovation when they can mine your data for immense profits.
## Case 1
And the dream case: Linux for the win! Eric Raymond's argument is definitely the most bizarre and interesting endgame I've heard of resulting in this case, and it seems... un-Microsofty in my opinion. Even if it were to happen, it would definitely be at least five years away. It just doesn't really make sense for Microsoft to completely nuke their NT kernel, especially with Windows 10X right around the corner. Maybe this could happen 10 years from now though, but I still think it's kind of unlikely. But really, is the current situation *sustainable* in the long run? Linux has taken over the server market and a huge chunk of the mobile market, why not the desktop market next? If preinstalled hardware really becomes a thing, a big thing, and app support gets ironed out as more people switch, it could become a positive feedback loop!
Let's think in terms of a small disturbance, like in calculus. What if Linux market share, by complete chance, were to take a step in the upward direction, say, tick up from 3% to 3.01%? Assuming there are one billion PCs out there, that's an increase by 100 thousand! That's 100 thousand more potential consumers for your Linux app or hardware. And this could have an impact, a small impact, but one nonetheless, on the amount of effort that hardware companies spend on Linux compatibility, or developers making a few more ports to Linux, or just having a [larger community](/blog/2021/02/14/i-btw-use-arch.html) of people to interact with. It could make people less likely to choose macOS over Linux. So those are all positive feedback things.
What about negative feedback? Well, there are quite a lot of problems with Linux right now, such as lack of apps in important areas, and the general need to be more technically capable. If this was a post about messaging apps, I would also bring up [network effects](https://en.wikipedia.org/wiki/Network_effect), which arguably applies here as well. There's quite a lot of negative feedback going on here, so it's hard to say whether we are in a stable or unstable equilibrium.
## A final thought
Does market share even matter? Linux market share has been pretty much stagnating since 2015, with a small peak in June 2020. To end things here, I'll just say that existing methods of estimating market share are not exactly known for being precise, and it's near impossible to estimate exactly how many people use Linux, so I wouldn't say it's a number we should intently focus on.
Thanks for reading these disorganized ramblings. Now what's the proper way to end a video call...
References:
- http://esr.ibiblio.org/?p=8764
- https://www.computerworld.com/article/3438856/call-me-crazy-but-windows-11-could-run-on-linux.html
- https://hothardware.com/news/microsoft-and-linux-sitting-in-a-tree
- https://www.neowin.net/news/eric-raymond-thinks-microsoft-is-ready-to-swap-out-the-windows-kernel-for-linux

View file

@ -0,0 +1,22 @@
---
title: "Fun with QEMU/KVM! - The Sequel"
date: 2021-01-07
draft: true
type: "post"
tags: ["Linux", "Virtualization"]
---
*Originally posted on my [old blog](https://git.exozy.me/Ta180m/blog/src/branch/main/_posts/2021-01-07-fun-with-qemu-kvm-2.md)*
![Linux Mint with 255 cores](/blog/assets/mint-255-cores.png)
As far as I know, there aren't any 255 core processors on the market. Yet. But that doesn't stop us from making a virtual machine using [QEMU/KVM](/blog/2020/11/18/fun-with-qemu-kvm.html) and [SMP](https://en.wikipedia.org/wiki/Symmetric_multiprocessing) with an absurd number of processors, as shown above.
Why 255? Well, that's the limit apparently. Yeah, it sucks. I wish it was higher too. But if you're running more cores than the number of physical cores available on your computer, there's no benefit and you'll probably see worse performance. No one even has that many physical cores to begin with, so there's no incentive for QEMU/KVM to support even more cores. I'm pretty sure that only the first 64 cores are KVM acclerated, which adds another reason why you shouldn't do this. (virt-manager also warns you from against a VM more cores than you actually have. It's a bad idea.)
And why [Linux Mint 20.1](https://www.linuxmint.com/rel_ulyssa_cinnamon.php) MATE? Well, it happened to have been released lately, and I haven't had much exposure with MATE, so I thought it would be the perfect opportunity to download an ISO and take it for a spin with 255 cores.
One final note to application developers: make sure your software can handle extreme, absurd cases. Corner cases will screw you over if you don't prepare for them in advance! MATE System Monitor seems to be handling the overabundance of cores quite well, but the window automatically resizes based on the number of cores, and I can't scroll down. Still, the system seems to be handling it, and of course, there isn't any general reason why you would want to use so many cores, unless you were trying to impress your friends. Maybe 255 (most likely 256) cores will become the norm someday since frequency scaling is long dead by now. And then all the apps and tools that print out the status of every core will really be screwed.

View file

@ -0,0 +1,38 @@
---
title: "Fun with QEMU/KVM!"
date: 2020-11-18
draft: true
type: "post"
tags: ["Linux", "macOS", "Virtualization"]
---
*Originally posted on my [old blog](https://git.exozy.me/Ta180m/blog/src/branch/main/_posts/2020-11-18-fun-with-qemu-kvm.md)*
For many people, "virtual machine" is effectively synonymous with VirtualBox or VMWare or perhaps Hyper-V. But for us Linux users, there is actually another alternative. You may have heard of QEMU before, but it's an emulator and therefore much slower than hypervisors like VirtualBox. However, by using the Linux kernel's built-in kernel virtualization module (KVM) combined with QEMU, we can achieve impossible near-native speeds. So let's see what we can do with QEMU/KVM...
Let's try Debian first:
![Debian](/blog/assets/debian.png)
Not bad! It seems much faster than VirtualBox or VMWare, or maybe that's just because of i3... The CPU is definitely running at almost-native speeds, the disk speed -- not so much, as expected. It's also detecting a paravirtualized graphics card, so the graphics aren't too bad, but there's no OpenGL unfortunately. Anyways, QEMU/KVM is going pretty strong so far.
Let's give Android-x86 a try:
![Android-x86](/blog/assets/android-x86.png)
Pretty good! I don't think Android is detecting the paravirtualized graphics card, so that might explain the sluggish graphics performance. I can even connect to it using KDE Connect! It's using a lot of RAM, but my computer's fans aren't spinning like crazy like when I run a VM using VirtualBox.
Now time for some [OSX-KVM](https://github.com/kholia/OSX-KVM):
![Big Sur](/blog/assets/big-sur.png)
Surprisingly, even Big Sur runs fantastically. OK, maybe not fantastically, since there's no graphics card, so the graphics are very sluggish this time, but other than that, it's much better than something I could hack together with VMWare or VirtualBox. QEMU might even become the optimal way for Hackintoshes, since Apple Silicon has spelled the end of running macOS on other processors. Big Sur also uses quite a lot of RAM, but I think using i3 on my host laptop helps. And it just happens to be the same resolution as my laptop screen, so when I go fullscreen... complete immersion! Just like a real Mac with a nonexistent graphics card, I guess?
Overall, QEMU/KVM combines the flexibility of QEMU, a general-purpose emulator, with the speed of KVM, a built-in hypervisor module in the Linux kernel, to deliver an unbeatable virtualization solution for desktop users. The biggest drawback is that it is Linux-exclusive, obviously, although it apparently can run on WSL 2 with nested virtualization enabled with much worse performance. Virtual machines are no longer slow and resource-hogging, not if you use QEMU/KVM!

15
content/posts/future.md Normal file
View file

@ -0,0 +1,15 @@
---
title: "The Future"
date: 2020-10-05
draft: true
type: "post"
tags: ["Meta"]
---
*Originally posted on my [old blog](https://git.exozy.me/Ta180m/blog/src/branch/main/_posts/2020-10-05-future.md)*
Unfortunately, one of the recurring themes of this blog has been missed deadlines. I'm always saying, I'm going to finish this new post by this day, but when the day comes, it's almost always been pushed back. And I've concluded that the main reason is my goal for the quality of this blog is too high.
Why is this a problem? Isn't high quality a good thing? Well yes, but it's also much more time-consuming. I can draft a fast, low-quality post in a few minutes, but to get it to the quality that I want, it can take up to an hour. Juggling all the other stuff that I do, I just don't have time except for quick, low-quality posts like this one. After all, it's not like people are actually going to read this, so the quality really doesn't matter. This is more of a place that I can jot down my ideas.

View file

@ -0,0 +1,64 @@
---
title: "How to Hibernate"
date: 2021-01-04
draft: true
type: "post"
tags: ["Linux"]
---
*Originally posted on my [old blog](https://git.exozy.me/Ta180m/blog/src/branch/main/_posts/2021-01-04-how-to-hibernate.md)*
If you dual-boot, hibernation is a necessity. Need to use the other OS for a few minutes? No problem, just hibernate, and when you boot your original OS again, you'll be back where you left off.
However... It's 2021 and there still isn't an easy way to enable hibernation on Linux. Sad.
Anyways, here's a rough outline of the procedure using a swap file:
## Make a swap file
You generally want your swap file to be at least as big as your RAM, and if you do a lot of swap-intensive stuff, you might even need a bigger swap file.
```sh
# create a swap file
sudo swapoff -a # disable all swap
sudo dd if=/dev/zero of=/swapfile bs=1M count=8196 status=progress # create a 8GiB swap file
sudo chmod 0600 /swapfile
sudo mkswap /swapfile
sudo swapon -a # enable swap
# add it to /etc/fstab
sudo sed -i '/swap/{s/^/#/}' /etc/fstab
sudo tee -a /etc/fstab<<<"/swapfile none swap sw 0 0"
```
## Set kernel parameters
```sh
# get the resume parameters
RESUME_PARAMS="resume=UUID=$(findmnt / -o UUID -n) resume_offset=$(sudo filefrag -v /swapfile|awk 'NR==4{gsub(/\./,"");print $4;}') "
# add them to GRUB config
if grep resume /etc/default/grub>/dev/null; then echo -e "\nERROR: Hibernation already configured. Remove the existing configuration from /etc/default/grub and add these parameters instead:\n$RESUME_PARAMS";else sudo sed -i "s/GRUB_CMDLINE_LINUX_DEFAULT=\"/GRUB_CMDLINE_LINUX_DEFAULT=\"$RESUME_PARAMS/" /etc/default/grub;fi
sudo update-grub # for Debian-based distros
sudo grub-mkconfig -o /boot/grub/grub.cfg # for Arch
```
If you're using Arch, make sure you also [configure the initramfs](https://wiki.archlinux.org/index.php/Power_management/Suspend_and_hibernate#Configure_the_initramfs).
And... that's it!
If you have problems, make sure secure boot is disabled and check your BIOS settings. NVIDIA drivers are also problematic. If you're stuck, the internet can probably help.
Further reading:
- [Tutorial for swap files](https://forums.linuxmint.com/viewtopic.php?t=284100)
- [Tutorial for swap partitions](https://forums.linuxmint.com/viewtopic.php?f=42&t=273202)
- [From the ArchWiki](https://wiki.archlinux.org/index.php/Power_management/Suspend_and_hibernate)

View file

@ -0,0 +1,45 @@
---
title: "print(\"Hello, world!\") - Part 0"
date: 2020-09-01
draft: true
type: "post"
tags: ["Programming"]
---
*Originally posted on my [old blog](https://git.exozy.me/Ta180m/blog/src/branch/main/_posts/2020-09-01-print-hello-world-part-0.md)*
> *Your first podcast will be awful
> Your first video will be awful
> Your first article will be awful
> Your first art will be awful
> Your first photo will be awful
> Your first game will be awful
> But your first code will be perfect.
> Zero bugs and very clean code.
> It will be "Hello, world!"*
>
> *-- Anonymous*
For the past few years, "programming" and "C++" have been pratically synonymous for me. I knew about the wild world of other programming languages, but for the most part, I just stayed in my little C++ bubble. After all, for competitive programming, C++ is enough.
But C++ has its limits. For [modeling infections diseases](https://github.com/Ta180m/Infectious-Disease-Modeling), its lack of easy-to-use scientifc and numerical libraries complicated my project, and I ended up using Python. And AP Computer Science, which should really be called *AP Java Language and Composition*, forced me to learn Java. (Although I think College Board should switch to Python for that course) And trying out a new programming language couldn't be easier, with loads of online tutorials and compilers such as [OnlineGDB](https://www.onlinegdb.com/). And if I want to actually run a language on my Ubuntu computer and do benchmarks, I can just `sudo apt install` it.
## So what is this project?
This project is not meant to be an objective comparison of programming languages. Comparing programming languages with benchmarks is notoriously difficult, and there are already [great resources](https://benchmarksgame-team.pages.debian.net/benchmarksgame/) out there for that, so think of this project as more of a personal exploration of infinite universe of programming languages. (And don't take my "benchmarks" too seriously)
## So what are you going to do, anyways?
This is were the pseudocode below comes into play:
<script src="https://emgithub.com/embed.js?target=https%3A%2F%2Fgithub.com%2FTa180m%2Fprint-Hello-World-%2Fblob%2Fmaster%2Ftest.txt&style=hybrid&showBorder=on&showLineNumbers=on&showFileMeta=on"></script>
It contains everything to give a quick, high-level overview of a programming language: a recursive function definiton, an `if else` statement, an array or list, a `for` loop, and two nested loops through the array or list. The entire program has time complexity `O(N^2 log N)` of course, and with `N = 1000`, this runs at around a second in a typical programming language, allowing us to make some rough performance comparisons. (Although you really shouldn't take these measurements too seriously, as I said above)
I already have it implemented in about 10 different programming languages so far, so I'll try to post a new part about my experience with each language every day. I'm aiming for at least 20 language, but we'll see. It's all in the [GitHub](https://github.com/Ta180m/print-Hello-World-).
Anyways, check back ~~tomorrow~~ in two weeks for C++!

View file

@ -0,0 +1,29 @@
---
title: "print(\"Hello, world!\") - Part 1"
date: 2020-09-17
draft: true
type: "post"
tags: ["Programming"]
---
*Originally posted on my [old blog](https://git.exozy.me/Ta180m/blog/src/branch/main/_posts/2020-09-17-print-hello-world-part-1.md)*
> *“C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off.”*
>
> *-- Bjarne Stroustrup, creator of C++*
There are a few reasons why the vast majority of competitive programmers use C++: it has a decent standard library, several good reference sources, and lots of tutorials online. But these factors are not unique to C++; what matters is its speed. A few milliseconds could be the difference between and accepted solution and time limit exceeded. Anyways, here's the code, about two weeks late, written in the "conventional" C++ style, as opposed to the condensed, macro-abusing style of competitive programmers.
<script src="https://emgithub.com/embed.js?target=https%3A%2F%2Fgithub.com%2FTa180m%2Fprint-Hello-World-%2Fblob%2Fmaster%2Ftest.cpp&style=hybrid&showBorder=on&showLineNumbers=on&showFileMeta=on"></script>
| Factor | Rating | Description |
| --- | --- | --- |
| Speed | 3 | Very fast after compilation, nearly as fast as C, and faster than a lot of programming languages even counting compilation |
| Documentation | 3 | Not that I used any when writing this program, but there a lot of good resources out there, such as [cplusplus.com](www.cplusplus.com) |
| General | 3 | C++ has its flaws, but for some applications such as competitive programming, it's unbeatable |
Be on the lookout for Part 2, Python! No guarantees about the date, but it should show up in a few days, once I get some time.

View file

@ -0,0 +1,29 @@
---
title: "print(\"Hello, world!\") - Part 2"
date: 2020-09-24
draft: true
type: "post"
tags: ["Programming"]
---
*Originally posted on my [old blog](https://git.exozy.me/Ta180m/blog/src/branch/main/_posts/2020-09-24-print-hello-world-part-2.md)*
> *“The canonical, "Python is a great first language", elicited, "Python is a great last language!"”*
>
> *-- Noah Spurrier*
I think we can all agree that Python is a wonderful first language to learn, with easy, clean syntax, making it easy to learn, write, and read. (The last one is very important: code is usually written once, but read many times) But is it a great last language? Its huge abundance of modules and libraries for Python makes it really easy to cool programs that would take thousands of lines of code in other languages. You really can do anything with Python! But it won't be fast: when you need speed, Python simply can't compete.
<script src="https://emgithub.com/embed.js?target=https%3A%2F%2Fgithub.com%2FTa180m%2Fprint-Hello-World-%2Fblob%2Fmaster%2Ftest.py&style=hybrid&showBorder=on&showLineNumbers=on&showFileMeta=on"></script>
| Factor | Rating | Description |
| --- | --- | --- |
| Speed | 2 | One of Python's main drawbacks, PyPy is better but has its own flaw |
| Documentation | 3 | [docs.python.org](docs.python.org) is pretty good, there are also tons of other resources |
| General | 3 | Overall very good for a wide variety of applications, with only a few flaws |
I should be able to find some time to write up Part 3, Java, by next week.

View file

@ -0,0 +1,29 @@
---
title: "print(\"Hello, world!\") - Part 3"
date: 2020-09-29
draft: true
type: "post"
tags: ["Programming"]
---
*Originally posted on my [old blog](https://git.exozy.me/Ta180m/blog/src/branch/main/_posts/2020-09-29-print-hello-world-part-3.md)*
> *If Java had true garbage collection, most programs would delete themselves upon execution.*
>
> *-- Robert Sewell*
Java -- gives me AP Computer Science memories (although I think they'll switch to Python soon) -- the epitome of object-oriented programming. Not saying that OOP is bad -- it has its uses, such as with GUI toolkits -- but also [drawbacks](https://www.quora.com/Why-did-Dijkstra-say-that-%E2%80%9CObject-oriented-programming-is-an-exceptionally-bad-idea-which-could-only-have-originated-in-California-%E2%80%9D?share=1). I just don't appreciate how it tries to force OOP upon me whenever I use it.
<script src="https://emgithub.com/embed.js?target=https%3A%2F%2Fgithub.com%2FTa180m%2Fprint-Hello-World-%2Fblob%2Fmaster%2Ftest.java&style=hybrid&showBorder=on&showLineNumbers=on&showFileMeta=on"></script>
| Factor | Rating | Description |
| --- | --- | --- |
| Speed | 3 | Quite fast after compiling to bytecode |
| Documentation | 3 | I really want to give Java a 2 due to personal bad experiences, but there are lots of good resources out there |
| General | 2 | Yes! I can finally give Java a 2 |
I'm giving myself a two-day deadline for Part 4, C.

View file

@ -0,0 +1,23 @@
---
title: "Random Tidbits"
date: 2020-10-28
draft: true
type: "post"
tags: ["Random", "Linux"]
---
*Originally posted on my [old blog](https://git.exozy.me/Ta180m/blog/src/branch/main/_posts/2020-10-28-random-tidbits.md)*
## Play videos in your terminal!
![On YouTube](/blog/assets/tux-video.png){: height="300px" } ![In a terminal](/blog/assets/tux-text.png){: height="300px" }
Assuming you have mpv, just run `CACA_DRIVER=ncurses mpv -vo=caca *path_to_video*`.
You can also pipe `youtube-dl` into this command, but sometimes I get a bunch of cryptic error messages. I've found that downloading the video beforehand tends to work better.
I also recommend turning down your terminal's font size.
Goodbye X, hello tty!

View file

@ -0,0 +1,24 @@
---
title: "Sharing is Caring"
date: 2021-04-30
draft: true
type: "post"
tags: ["Web", "Society"]
---
*Originally posted on my [old blog](https://git.exozy.me/Ta180m/blog/src/branch/main/_posts/2021-04-30-sharing-is-caring.md)*
[In an in an interview a few days ago](https://en.wikinews.org/wiki/Wikinews_discusses_DRM_and_DMCA_with_Richard_Stallman_after_GitHub_re-enables_public_access_to_youtube-dl), Richard Stallman was asked how publishers should sell copyrighted works. His response:
> The words you are using, I will not accept. I'm not going to answer that question because to do it I would have to accept the concept of piracy and the concept of protected and I will not. I refuse to use them. When people, when they say piracy what they mean is sharing. It's a smear term to insult people who share. I will not smear sharing. I think sharing is good and stopping people from sharing is evil. Now I when they say protected, what they really mean is restricting. And I think that's bad. However I am in favor of supporting artists better. The existing system changes so as to support artists less and less. Now this has become a scandal in the field of music as the streaming disservices pay musicians so little when streaming their music that the musicians are basically going broke. What this shows by the way is the hypocrisy of the copyright system which ostensibly exists to support the artists. But in fact it supports businesses that screw the artists.
Keep in mind that Stallman also said that "for other kinds of works, such as artistic works and works of testimony, it's okay for those works to be copyrighted" in the same interview.
So I'm going to make this loud and clear: **If you download a file that you were not willing to pay for in the first place, there is no economic loss to the publisher.** I'm not advocating this, I'm just putting out the obvious. Publishers don't care about people who weren't willing to pay in the first place; they're worried that massive sharing would lead to customers that would actually pay end up just downloading files for free.
Also, if you never pay for games, you can get an infinite number of games for zero dollars! Obvious, right?
So there you have it. A disorganized ejection of various ideas about sharing. I might add some more arguments if I think of more obvious truths about this topic.

View file

@ -0,0 +1,143 @@
---
title: "So You Want to be Anonymous Online?"
date: 2021-04-23
draft: true
type: "post"
tags: ["Web"]
---
*Originally posted on my [old blog](https://git.exozy.me/Ta180m/blog/src/branch/main/_posts/2021-04-23-so-you-want-to-be-anonymous-online.md)*
Let's get started! The first thing to understand is that this goal is **impossible**.
> "A strange game; the only winning move is not to play."
Impossible. Unless, of course, you put all your electronics in a safe and never use them again. If you're up against a sufficiently determined adversary (like the government for instance), this is simply not possible.
But this isn't the goal of most people, or even the vast majority of people. Very few are actively seeking to prevent the government from spying on them, since it's practically impossible without making huge sacrifices. But for most people, you're mainly going to be trying to stop companies, such as the big tech monopolies like Google and Microsoft, from tracking you.
This requires us to define our **threat model**. What threat are we trying to stop from tracking us? Is it corporations, online trolls, law enforcement, the government, or something else?
Also, remember that **privacy and anonymity are closely related but different concepts**. Privacy is all about keeping your personal data private. It's about controling your personal data. But anonymity takes things a whole step further: not only are you in control, but you additionally hide your identity from third parties that you can't control. As you might expect, it takes significantly more work to achieve this!
The rest of this post is going to go through some possible actions you can take, ranging from mundane to extreme. Beware that the going down the extreme route is quite a big rabbit hole. Let's begin!
## So you care a little bit about privacy?
Here's a few easy things the everyday person can do.
### Use an ad-blocker
This one's easy! I highly recommend [uBlock Origin](https://ublockorigin.com/). Just install it, and it'll start blocking ads and trackers!
### Fiddle with your browser's privacy settings
Browsers like Firefox have settings like "strict tracking blocking" that you can enable. They aren't great, but it's a start. You should also turn off ad personalization in your Google settings.
### Use a password manager
Don't reuse passwords. If you're looking for a quick and easy solution, try a password manager!
### Use two-factor authentication
This is another easy thing to do. You're probably already doing it!
### Use incognito mode
Yeah, this doesn't really work. But at least you'll feel better.
## So you want to stop corporations?
Now it's going to start getting more and more extreme. Buckle in for the ride!
### Change your browser
The dominant browser, Google Chrome, is a privacy nightmare, as you might expect. The next alternatives, Firefox, Edge, and Safari, are not your friends either. The Brave browser is super sketchy so I wouldn't recommend it either. If you're serious, get [LibreWolf](https://librewolf-community.gitlab.io/). It's Firefox but with much better privacy settings.
### Change your search engine
Another sacrifice. Google search has a monopoly, and it's terrible for privacy. [DuckDuckGo](https://duckduckgo.com/) is somewhat better but not perfect. [StartPage](https://startpage.com/) is OK too. There's also [Searx](https://searx.me/). At this stage, any one of those three should be good. However, if you're feeling hardcore, they wouldn't be enough...
### Use a VPN
VPNs are not magic. They will not allow you to become anonymous. But they are an important step towards masking your IP address, so it's definitely something to look into.
## So you're really hardcore?
These steps are quite hardcore, and I wouldn't recommend them to almost anyone except for the most hardcore folks out there.
### Block nearly everything
uBlock Origin, mentioned above, can be configured to be a powerful anything blocker. With [hard mode](https://github.com/gorhill/uBlock/wiki/Blocking-mode:-hard-mode), you'll have significant protection against tracking, although at the expense of most sites being broken. [NoScript](https://noscript.net/) is another good extension to block JavaScript, but it breaks almost all websites.
### Don't use X
Pick any common website, and there's a large chance it'll be something you shouldn't use if you're at this stage. Basically any Google service. You should delete all your social media accounts, including Facebook, Twitter, Snapchat, Reddit, and Discord. Only use open source software when possible.
### Self host stuff
Whenever you use an online service, you're using someone else's hardware. And the vast majority of the time, they are going to be able to exert some power and control over you, and possibly use it as a way to spy on you. The solution? Run these services on your own hardware! Need a search engine? You can self-host Searx if you have a spare server lying around. Need GSuite? You can self-host Nextcloud, a great productivity suite alternative.
### Use Tor
[Tor](https://www.torproject.org/) has a bad reputation. It's notorious for being a tool that criminals use to remain anonymous. However, it's still far from perfect.
So what exactly is Tor? To understand, you have to know what onion routing is. Basically, it's like a convoluted relay race. You want to visit a website? First, your data is encrypted and hops to one of the several thousand Tor nodes around the world, and then it's encrypted again and hops from that node to another random one, and over again several times. When your data finally exits the Tor network, it's been spun around so much inside the network that it's incredibly hard to track. By successively nesting the encryption each hop, it's like adding layers to an onion, hence the name. Pretty cool!
It's not perfect, but works decently when paired with a good VPN.
### Use Tails or Whonix
These are simply Linux operating systems that have very good privacy settings, such as using Tor for all internet connections.
### Encryption
Encryption is your friend! If you use it wisely, it's a key step on the road to anonymity.
### Be careful with fingerprinting!
You can use [this site](https://amiunique.org/) to check if your browser's fingerprint is unique. It's one way Tor and VPN users can be tracked, so be careful!
### Use your phone as little as possible
Unless you have dumb phone, in which case you should be fine.
### Qubes!
[Qubes OS](https://www.qubes-os.org/) is straightup crazy. If you thought Tails was extreme, this will blow your mind. The key idea is to basically run everything in isolated virtual machines. By doing so, you can achieve an impressive amount of security and privacy.
## So you want to stop the government?
Pretty much no one should be doing any of these things, since they are very extreme, to say the least. Anyways, here we go!
### Have a normal online life
You're going to look awfully suspicious if you're doing these things (especially some of the things below). Having an alternative normal online life could be a good idea.
### Tor over VPN over Tor over VPN over Tor
The basic idea is to nest these services several times, further confusing anyone trying to track you. This should be reasonably effective, although it's probably not enough against governments.
### Get a new computer every time you want to visit a web site and destroy it aferwards
Not very environmentally friendly, but it works!
### Lock all your electronics in a safe and never go online again
This is it. The ultimate solution.
## Further reading
- [A basic privacy guide](https://onlineprivacy101.info/)
- [A 186 page guide that won't even stop the government](https://anonymousplanet.org/guide.pdf)
- [Some other good ideas](https://gist.github.com/bluehat/354432b82650d0a722ed)

View file

@ -0,0 +1,22 @@
---
title: "Wayland is a Scam"
date: 2020-04-21
draft: true
type: "post"
tags: ["Linux", "Rant"]
---
*Originally posted on my [old blog](https://git.exozy.me/Ta180m/blog/src/branch/main/_posts/2021-04-21-wayland-is-a-scam.md)*
With every new release of GNOME, Plasma, Ubuntu, and Fedora, there's always something about Wayland being hyped. Wayland support only keeps on getting better and better with each and every new release. There's only one problem: Wayland is almost 13 years old and still hasn't made much of a dent in X11's dominance. We've been promised for years and years that Wayland is the future, but a decade later, it still hasn't delivered. This, to put it simply, is a scam.
It's a common excuse that [Nvidia](https://www.youtube.com/watch?v=iYWzMvlj2RQ) has been restraining Wayland's progress, but that's hiding the truth. But look at what happened with systemd, which started at around the same time. By 2016, *all* major distros had completely finished the transition, and systemd was ubiqutious. (Much to the chagrin of its critics) Anyways, how did it happen, and how did it happen so quickly? Well, the answer lies in its excellent legacy support.
People have updated old Arch systems dating prior to the big transition without any problems. systemd can truly do anything its predecessors could do (and a lot more, leading to the common perception that it's extremely bloated), and transitioning was as simple as drop and replace. Can Wayland do that? No way! There's Xwayland, and Nvidia issues aside, it's half-baked an missing important functionality. Something as simple as scaling an Xwayland window leads to disgusting blurriness and artifacts. It's been like this for years, and may never be fixed. And to make matters worse, some apps are simply never going to be ported to Wayland, so we're going to be stuck with Xwayland for a long time.
What about Wayland itself? Unfortunately, it's not even close in terms of feature parity to X11 either! Basic things like color management are simply lacking, compared to X11. You can't just parade an incomplete project and call it the future of Linux graphics, when it still lags behind X11 in many areas.
There's a [great article by Dedoimedo](https://www.dedoimedo.com/computers/wayland-2021.html) about this topic, where he takes the conservative position that Wayland isn't even needed at all. That's another common criticism of Wayland, but any of these critics haven't seen the gory mess that is modern X11. The X protocol was invented more than a decade before GPUs started becoming commonplace, so you can imagine how backwards it is. And over the years, it's been augmented in countless ways, hacking in support for touchscreens, high DPI, you name it. It's somehow chugged along, becoming increasingly bloated and hard to maintain, so Wayland wasn't created just so Red Hat could rake in profit. (Neither was systemd, despite its fiercest critics's claims otherwise) But compare the transition with systemd, and it's blatantly obvious that something seriously wrong has been going on in the past 12 years. With Nvidia's recent announcement to invest more in supporting Wayland, there's hope that this mess could start cleaning itself up. I'm not optimistic.

View file

@ -0,0 +1,44 @@
---
title: "Weird Linux Tricks"
date: 2020-12-23
draft: true
type: "post"
tags: ["Random", "Linux"]
---
*Originally posted on my [old blog](https://git.exozy.me/Ta180m/blog/src/branch/main/_posts/2020-12-23-weird-linux-tricks.md)*
## Impress your friends with one weird trick!
Linux is pretty tricky. Here are a few actually useful tricks.
## GDB GUI, or should I say TUI
I've got some mixed feelings about VSCodium, the text editor that I use. It's not bad, but as an Electron app, it predictably has terrible performance issues. For instance, compiling a tiny C++ file can take 10 times as long in VSCodium versus compiling it in the terminal. However, one thing that it does great, with the help of the phenomenal extension [Native Debug](https://github.com/WebFreak001/code-debug), is the excellent (although slow) integrated graphical debugging experience, using `gdb` as the backend. People often decry GUIs for being bloated and not much more useful than the command line, but in this case, the graphical debugger helps me keep track of where I'm at in my code. ([Try watching videos in your terminal](/blog/2020/10/28/random-tidbits.html)) Anyways, I've been trying to find a replacement, but no other editor seems to have this nice integration. Then I found out that `gdb` has its own GUI. Or more accurately, a TUI. Just run `gdb` with the `--tui` switch and it should start up with a split screen, with your code at the top and the `gdb` command line at the bottom. Perfect!
![GDB Tui](/blog/assets/gdb-tui.png)
## `ip` color
`ip` is one of those commands that always spits out a heap of output, even when I just want something as simple as my IP address. OK, networking is hard, but still, no need to give me several pages of output. Color is here to save the day. Try `ip address` versus `ip -c address` and see for yourself!
## Go home
Easy. `cd`. That's it. No aliases needed; should work in basically any shell.
## Sparse files
Sparse files are pretty much black magic. Enough said. Basically, only used space is allocated, so a 14TB file containing all zeroes can be represented with no additional storage. You can have all the 14TB files that you ever want!
![A 14TB file](/blog/assets/sparse-file.png)
Here's a 7 exibyte file, produced using [this technique](https://rwmj.wordpress.com/2020/11/04/ridiculously-big-files/). Now you can brag to four friends about your 7 exibyte hard drive!
![A 7EiB file](/blog/assets/ridiculously-big-file.png)

View file

@ -0,0 +1,39 @@
---
title: "Weirder Linux Tricks"
date: 2021-02-21
draft: true
type: "post"
tags: ["Random", "Linux"]
---
*Originally posted on my [old blog](https://git.exozy.me/Ta180m/blog/src/branch/main/_posts/2021-02-21-weirder-linux-tricks.md)*
Here's some more weirder Linux tricks, if the [first post](/blog/2020/12/23/weird-linux-tricks.html) wasn't enough.
## Faster than host guest
What? How can the VM be faster than the host? It's possible if the host is a [`systemd-nspawn`](/blog/2021/01/03/worst-init-system-best-tool.html) container. Just pass through KVM acceleration with `--bind=/dev/kvm`, and you'll be shocked at how much faster the VM is compared to the `systemd-nspawn` container. Yes, for raw CPU virtualization, KVM really is that fast.
## Arch all the way down
[Meta](https://github.com/Ta180m/Arch-All-the-Way-Down)!
## Make Linux fast again
Pass the `mitigations=off` kernel parameter in your bootloader to disable all CPU exploit mitigations that protect you from the nasty [Spectre](https://en.wikipedia.org/wiki/Spectre_(security_vulnerability)) and [Meltdown](https://en.wikipedia.org/wiki/Meltdown_(security_vulnerability)) vulnerabilities. This is pretty much the pretty much the computing equivalent of anti-vaxxing, since widespread patching against these vulnerabilities have prevented them from showing up in attacks in the wild. However, the performance gains are really not worth the risk, so use this very wisely!
## DoS yourself!
Don't run `:(){:|:&};:`. Don't do it. If you want to take the risk, first limit the number of processes you can run with `ulimit`. You've been warned.
## `sudo rm -rf /dev/cpu/0/`
OK, not really, but you can do `echo 0 | sudo tee /sys/devices/system/cpu/cpu0/online` to disable CPU 0. Just don't try to take down all your processors at the same time.