Skip to content

Commit

Permalink
vault backup: 2024-04-30 11:10:38
Browse files Browse the repository at this point in the history
  • Loading branch information
abhiaagarwal committed Apr 30, 2024
1 parent 51f591f commit 6661a13
Show file tree
Hide file tree
Showing 11 changed files with 131 additions and 4 deletions.
9 changes: 7 additions & 2 deletions content/education/omscs/cs-6200.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ My first class I took at Georgia Tech's OMSCS program was cs-6200, or Graduate I

I loved the class. It's probably my favorite class I've taken in anything, ever.

In GIOS, the cool thing is that the projects are open-ended. All you have to do is pass a test suite they provided. For Project 1, I did it strictly by the book. For Project 3, I did something very weird and zany to the point where the Autograder actually got confused by my project, leading to a manual grading required (apologies to my TA).
In GIOS, the cool thing is that the projects are open-ended. All you have to do is pass a test suite they provided. For Project 1, I did it strictly by the book. For Project 3, I did something very weird and zany to the point where the Autograder actually got confused by my project, leading to a manual grading required. Project 4 was my least favorite: it uses gRPC and C++, and I ended up disliking both by the end of it.

### Notes I wrote because of this class

[[sending-fds-through-uds]]: I utilized this in Project 3.

[[fcntl-atomic-locks]]: I utilized this in Project 3, though I had to scrap my usage of it because I discovered it doesn't work as expected.

[[macos-native-docker]]: The class environment is an Ubuntu 20.04 x86 environment, I needed to run a class-provided docker image to perfectly replicate our testing environment to make sure I wasn't dealing with quirks. I use a M1 Pro Macbook 14 that I absolutely adore, and didn't want to deal with a Cloud VM to develop.
[[macos-native-docker]]: The class environment is an Ubuntu 20.04 x86 environment, I needed to run a class-provided docker image to perfectly replicate our testing environment to make sure I wasn't dealing with quirks. I use a M1 Pro Macbook 14 that I absolutely adore, and didn't want to deal with a Cloud VM to develop.

[[basic-fstream]]: I spent over 3 hours debugging this problem in Project 4. I hate C++.

[[destructive-moves]]: A design choice I made in Project 4 was rendered impossible due to this.
6 changes: 4 additions & 2 deletions content/education/omscs/cs-7674.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ tags:
aliases:
- ml4t
---
My second class at OMSCS was cs-7674, Machine Learning for Trading (**ML4T**). I thought it was... alright? It's mostly just Python stuff, of which I'm very familiar with. I took it alongside [[cs-6200|gios]]. It's kind of like an introduction into data science techniques with a focus on ML. Now I'm not an ML person at all, my undergraduate background is in Economics and Math, but ML is just statistical models.
My second class at OMSCS was cs-7674, Machine Learning for Trading (**ML4T**). I thought it was... alright? It's mostly just Python stuff, of which I'm very familiar with. I took it alongside [[cs-6200|gios]]. It's kind of like an introduction into data science techniques with a focus on ML. Now I'm not an ML person at all, my undergraduate background is in economics and math, but ML is just statistical models. I came in not knowing much and breezed through the class with said knowledge of statistics.

I spent maybe 10 hours per week on the class.
I'm probably killing my career by saying ML isn't really my cup of tea. Honestly, stocks aren't either, I'm a believer in the Efficient Market Hypothesis and [[stocks|buy $VTSAX and chill]]. I'm more interested in ML from a mathematical standpoint, this class is mostly Applied ML. It'll certainly help you get a job, if that's what you're looking for.

I spent maybe 10 hours per week on the class. I didn't feel really engaged during the class at all.

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.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I watch a lot of basketball. This is an attempt to catalogue every moment that affected me on a personal level and possibly changed my life.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
title: Jamal Murray's game-winner against the Lakers, April 22nd, 2024
tags:
- thoughts
---
I'm a closeted fan of the Denver Nuggets. Nikola Jokic is my favorite player, ever, and I will confidently argue that he's currently in the greatest offensive peak ever. I love Denver and Colorado broadly, it's pretty much my ideal place to live.

I hate the Lakers. I'm a Celtics fan, hating the Lakers is in my blood. People who act like sports is supposed to be some egalitarian kumbaya is a fucking liar. The only thing that brings me more pleasure than my team winning is seeing my enemies suffer.

So, thank you Jamal Murray, for playing like dogshit for most of the game, letting the Lakers get a 20 point lead on you, then going 6/8 in the fourth quarter and hitting an incredible game winner on AD, who spent the prior morning whining about not being defensive player of the year.

![[Screenshot 2024-04-23 at 1.14.40 AM.png]]
This was my live reaction. The Nuggets have now beat the Lakers 10 times in a row. They're likely going to get swept again.

I love basketball.

![[-V2FLa-nYVTeUrfn.mp4]]
10 changes: 10 additions & 0 deletions content/technology/hardware/nvidia/installing-cuda-on-lxc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Installing CUDA/Nvidia Drivers on a host to be shared with Linux Container(s)
tags:
- observations
---
I have a 4090 GPU. I want to share the GPU across multiple lightweight Linux Containers (LXCs), of which they might share them with Docker containers, which could theoretically share... whatever, you get it. I want access to `nvcc` on LXCs for development.

This is a little bit more of a convoluted process than it may seem like. It involves messing with the kernel, building kernel modules, downloading multiple packages, but in the end, you get a GPU that can be used in multiple contexts avoiding the overhead of virtualization, with all the upside of containerization and isolation.

I'm doing this on a fresh installation of proxmox. My server is using a 7950x3D + a RTX 4090 PNY. Yes, overkill, it's a dual gaming/workstation/ML server that's rack-mounted.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
tags:
- thoughts
title: "`basic_fstream` will sometimes fail. And it won't tell you."
---
I have a file that I'm streaming from a gRPC endpoint as stream of bytes (that could be of arbitrary size, but I aligned to 1024kb). I want to replicate those bytes on the filesystem.

Easy enough, we have to open our file with `std::ios::binary` to indicate that we're dealing with binary data, that we don't want our file to treat any characters like they mean anything. I'll give you a `std::vector` of some data, it holds its size, you throw it in the file via `fstream::write`. Easy enough, shouldn't be any footguns, right???

Since they are bytes, I don't want to use `char` (ie `int8_t`) and instead use the standard `uint8_t` (which in more modern c++ versions, would be `std::byte`, but I'm working with c++14). Easy enough, I simply specialize `fstream` with the underlying `basic_fstream` as `basic_fstream<std::uint8_t>`. Right, right???

Alright, before I get into this stupid footgun, I also want to point out that gRPC represents the protobuf datatype `bytes` as a `std::string`. I can understand why they did this, technically, since a `std::string` is just a `const char*` with a little bit of metadata so we can store `\O` characters inside of it. It should probably be an `std::vector<uint8_t>` (or `std::byte`) to represent that it isn't text content, but whatever. [Here's an issue for this](https://github.com/protocolbuffers/protobuf/issues/5431). Just means we have to use a lot of nasty `reinterpret_cast`s.

Anyways, here's something cool. If you attempt to write to open a given file as an `basic_ifstream<std::uint8_t>`, it works. The error bit isn't flipped. Now, if you attempt to write to it, it will fail.

```cpp
using binary_fstream = std::basic_ifstream<std::uint8_t>;

binary_fstream file("binary.dat", std::ios::out | std::ios::in | std::ios::binary);
if(file.good()) {
std::cout << "Our file is good, why are you asking?" << std::endl;
}

std::vector<std::uint8_t> buffer = { ... }
file.write(buffer.data(), static_cast<long>(buffer.size()));
if(file.good()) {
std::cout << "Our write totally suceeded, right?" << std::endl;
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: C++ doesn't have destructive moves.
tags:
- thoughts
---
C++'s greatest innovation is RAII, "Resource Acquisition is Initialization." Despite its name, RAII has little to do with initialization, but rather destruction. In a RAII paradigm, an objects lifetime is tied to its scope, and its destructor is called when the scope ends. This is immensely helpful, as anyone who has seriously written C can tell you that a solid 90% of C code is just cleanup.

Unfortunately, C++'s ability to be wrong about everything means that it also suffers a big footgun with the lack of destructive moves.

Now, I'm gonna tell you the reason this surprised me is that I'm really used to Rust these days. The concept of a "non-destructive" move doesn't really make sense to me, since I'm used to move semantics... moving data.

Here's a toy example of the problem:

```cpp
class MyVeryCoolObject {
public:
MyVeryCoolObject() {
std::cout << "I am initialized!" << std::endl;
}
~MyVeryCoolObject() {
std::cout << "I have been destroyed :(" << std::endl;
}
};

int main() {
auto verycoolobject = MyVeryCoolObject();
{
auto coolerobject = std::move(verycoolobject);
}
return 0;
}
```
You may think the answer to this question is obvious:
```bash
I am intialized!
I have been destroyed :(
```

Since we moved the data, our `verycoolobject` no longer exists, its "guts" have been moved into the `coolerobject`. Then, at the end of the scope we created, `coolerobject`, which had the guts of the original object, will call its destructor. Then, at the end of the main block, since `myverycoolobject` is, uh, nothing, it will simply never call its destructor because it doesn't exist. Right. Right?

Here's what it actually outputs, compiled with `Apple clang version 15.0.0 (clang-1500.3.9.4)`.

```
I am intialized!
I have been destroyed :(
I have been destroyed :(
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
I really don't like c++. It was the first language I ever learned, at the ripe age of 13. I nearly gave up programming because of it. cpp reminds me a lot of english. Powerful, expressive, but none of it makes sense and there are so many footguns that I'm glad I have a few toes remaining.

This is a running list of all the times cpp's stupid behavior has burnt me.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
title: Why does Javascript have so many config formats?
tags:
- thoughts
---
I've been learning Typescript recently. And I'm astonished at how many freaking configuration files I need.

Vite needs its own config file. Eslint needs its own configuration file. The configuration file formats aren't unified. Some of them are actual Javascript files, some of them are JSON files, some of them are YAML files.

Python may have its issues, but at least the community has agreed to let `pyproject.toml` be the source of truth. Flake8 tried to play games and has been taken over by `ruff`.

0 comments on commit 6661a13

Please sign in to comment.