Skip to content

Commit

Permalink
cleanse
Browse files Browse the repository at this point in the history
Signed-off-by: Haile Lagi <[email protected]>
  • Loading branch information
hailelagi committed Jan 29, 2024
1 parent 0ab578a commit 9aeecc8
Show file tree
Hide file tree
Showing 11 changed files with 137 additions and 161 deletions.
20 changes: 0 additions & 20 deletions content/crdts_for_mortals.md

This file was deleted.

2 changes: 1 addition & 1 deletion content/hacks/thumbelina.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ date: 2023-12-20T17:44:15+01:00
draft: false
publicDraft: false
publicArchive: true
tags: producer-consumer, FFI
tags: elixir, rust, FFI
recommend: false
---

Expand Down
122 changes: 0 additions & 122 deletions content/obsidian-notes/main.zig

This file was deleted.

127 changes: 127 additions & 0 deletions content/obsidian-notes/zig-in-a-weekend.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,130 @@ pub fn main() void {
std.debug.print(thing, .{});
}
```

### First Impressions

```zig
const std = @import("std");
/////////////////////
// THROWAWAY NOTES //
/////////////////////
// struct with methods defined on `*Self` and associated by type
const Vector = struct {
x: f64,
y: f64,
z: f64 = 69.420,
fn print(self: *Vector) void {
std.debug.print("{}", .{self});
}
fn magnitude(self: *Vector) f64 {
var change = ((self.x * self.x) + (self.y * self.y) + (self.z * self.z));
return std.math.pow(f64, change, 0.5);
}
fn sum(a: Vector, b: Vector) Vector {
return Vector{ .x = a.x + b.x, .y = a.y + b.y, .z = a.z + b.z };
}
fn iam(_: *Vector) Axiom {
const rand = std.crypto.random;
var axiom: i8 = rand.intRangeAtMost(i8, 1, 4);
return @intToEnum(Axiom, axiom);
}
};
// enums
const Axiom = enum { Associative, Commutative, Identity, Inverse };
const Errors = error{EigenVector};
pub fn main() void {
// const var - var mut
const thing: i32 = 5;
var ichange: u32 = 50000;
// do not shadow: var ichange: u32 = 8;
_ = ichange;
// explicit cast to type with @as
const inferred_const = @as(i32, thing);
_ = inferred_const;
// fixed size array into slice
var a = [5]u8{ 1, 2, 3, 4, 5 };
// array slice
var b = &[6]u8{ 'w', 'o', 'r', 'l', 'd', '\n' };
var c: []u8 = a[0..3];
_ = c;
std.debug.print("{*}", .{b});
// bad do not implicity initialise/alloc
//var point = Vector{ 0.1, 0.2 };
// this is okay though!
var point = Vector{ .x = 0.1, .y = 0.2 };
var point_two = Vector{ .x = 0.2, .y = 0.3 };
std.debug.print("{}\n", .{point});
std.debug.print("{}\n", .{point_two});
std.debug.print("{}\n", .{point.magnitude()});
std.debug.print("{}\n", .{Vector.sum(point, point_two)});
std.debug.print("{}\n", .{point.iam()});
std.debug.print("{}\n", .{isZero(5)});
std.debug.print("{}\n", .{fitMePlease(50)});
std.debug.print("{}\n", .{fitMePlease(512)});
many();
if (eigenVector(false)) |value| {
std.debug.print("{}\n", .{value});
} else |err| {
std.debug.print("{}\n", .{err});
}
}
fn isZero(x: i32) bool {
if (x == 0) {
return true;
} else {
return false;
}
}
fn fitMePlease(x: f32) bool {
var divisible: u32 = @floatToInt(u32, @divFloor(x, 2));
return switch (divisible) {
2 => true,
4 => true,
8 => true,
16 => true,
32 => true,
64 => true,
128 => true,
256 => true,
// for exhaustive known invariants being ignored
// _ => true
else => false,
};
}
fn many() void {
var array = [_]i32{ 1, 2, 3 };
for (array) |value| {
std.debug.print("loop: {}\n", .{value});
}
}
fn eigenVector(todo: bool) !i32 {
if (todo == true) {
return Errors.EigenVector;
} else {
return 69;
}
}
```
6 changes: 5 additions & 1 deletion content/personal/funemployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ draft: false

tldr; I quit my day job! <3

<!--
If you really want to know ask me! I don't owe anyone an explaination. I joined a shit company. Whoops. Shit happens.
**Update - Dec 30th 2023**
I didn't want to speculate/burn bridges by detailing the reasoning why I resigned but
Expand All @@ -19,7 +23,7 @@ my only real option was to resign -- I didn't realise the full extent:
This... sucks, terribly.
**End Update**
**End Update** -->

## Why?

Expand Down
3 changes: 0 additions & 3 deletions content/resume.md

This file was deleted.

9 changes: 0 additions & 9 deletions content/tiny-node.md

This file was deleted.

1 change: 0 additions & 1 deletion content/writing/a-peek-into-the-beam.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ draft: false
tags: go, python, elixir, erlang, scheduler, concurrency
recommend: true
---
_First Draft: date: 2022-03-02T08:16:09+01:00_

A long time ago, you would give a computer an intensive set of instructions - in assembly or something more sane, and
it would compute these instructions one by one, but while it did that - it would “freeze up” you could not really do much
Expand Down
2 changes: 1 addition & 1 deletion content/writing/dev.to/break-your-next-server.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: 'Break your next server'
date: 2020-10-24T15:03:16.225Z
draft: false
draft: true
tags: ['elixir', 'otp', 'concurrency', 'architecture']
original: "https://atimetravellingghost.wordpress.com/"
---
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/hacks.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<h4 class="category"> Stuff I've Made/Making </h4>
<h4 class="category"> Experiments </h4>
{{ range where (where .Site.Pages "Section" "hacks" ) ".IsPage" "==" true }}
<ul id="posts">
<li>
Expand Down
4 changes: 2 additions & 2 deletions layouts/partials/intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<a href="https://en.wikipedia.org/wiki/File:Haile_Selassie.ogg"> haɪlə</a>
</p>

<p> I'm <a href="https://www.youtube.com/watch?v=5llYRcR-SAA"> taking it easy and having fun! </a></p>
<p> I'm currently <a href="https://www.youtube.com/watch?v=5llYRcR-SAA"> taking it easy and having fun! </a></p>

<p>Previously I've worked as a software engineer for <b>about 2 - 3 years</b>. Primarily
<p>Previously I've worked (remotely) as a software engineer for <b>about 2 - 3 years</b>. Primarily
on <i>financial technology</i> with
<a href="https://elixir-lang.org/">elixir</a>, <a href="https://www.ruby-lang.org/">ruby</a> and <a
href="https://go.dev/">go</a> — typically event-driven and most recently distributed systems.
Expand Down

0 comments on commit 9aeecc8

Please sign in to comment.