Skip to content

Instantly share code, notes, and snippets.

View astrolemonade's full-sized avatar
🔍
Happiness should be a pure function without any parameters.

astrolemonade astrolemonade

🔍
Happiness should be a pure function without any parameters.
View GitHub Profile
@astrolemonade
astrolemonade / 0-go-os-arch.md
Created March 27, 2023 21:10 — forked from asukakenji/0-go-os-arch.md
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
@astrolemonade
astrolemonade / unixhttpc.go
Created March 23, 2023 22:17 — forked from teknoraver/unixhttpc.go
HTTP over Unix domain sockets in golang
package main
import (
"context"
"flag"
"fmt"
"io"
"net"
"net/http"
"os"

Install Go using asdf for Visual Studio Code on macOS

I had a lot of issues trying to install Golang on macOS using asdf package manager to develop on Visual Studio Code.

So here's the steps needed to setup it properly:

Open Terminal and install asdf with this command:

You have to install Homebrew before running the installation command.

@astrolemonade
astrolemonade / hilbert_sort.py
Created March 10, 2023 13:28
Python implementation of the Hilbert Sort algorithm for sorting of one-dimensional data in a higher-dimensional space using the Hilbert curve
import numpy as np
# This is an implementation of the Hilbert Sort algorithm in Python.
def hilbert_sort(data: np.array):
# Map each number in the input array to a point in 2D space using the Hilbert curve
# Step 1: Convert each number to binary using zfill to ensure each binary string is 16 bits long
binary_array = np.array([list(bin(n)[2:].zfill(16)) for n in data], dtype=int)
@astrolemonade
astrolemonade / CoC.ml
Created February 25, 2023 18:42 — forked from hirrolot/CoC.ml
How to implement dependent types in 80 lines of code
type term =
| Lam of (term -> term)
| Pi of term * (term -> term)
| Appl of term * term
| Ann of term * term
| FreeVar of int
| Star
| Box
let unfurl lvl f = f (FreeVar lvl)
@astrolemonade
astrolemonade / starship.toml
Created January 30, 2023 13:11 — forked from ryo-ARAKI/starship.toml
Starship configuration file
# ~/.config/starship.toml
[battery]
full_symbol = "🔋"
charging_symbol = "🔌"
discharging_symbol = "⚡"
[[battery.display]]
threshold = 30
style = "bold red"
@astrolemonade
astrolemonade / guide.md
Created January 21, 2023 17:20 — forked from rosswd/guide.md
How to stop Steam Big Picture opening when the guide button is pressed

How to stop Steam Big Picture opening when you press the guide button on your XBox Controller

Scenario: You have an XBOX One Controller, or similar, and to turn off the controller you press and hold the guide button. Unfortunately, even though you have turned off guide button focuses steam in Steam's Controller Settings, the button press still opens Big Picture Mode.

Guide

  • With your controller on, open Controller Settings: Steam > Settings > Controller > General Controller Settings
  • Using the controller, highlight Xbox One Controller or similar, navigate to Define Layout and press A on the controller

steam_2020-12-13_16-27-41

The next step involves remapping the Guide Button to another button and then reassigning that button back to the original. This will leave the guide button unassigned so that the controller can be turned off without Steam getting involved.

@astrolemonade
astrolemonade / reg_vm.rs
Created January 1, 2023 20:51 — forked from leddoo/reg_vm.rs
a very simple register vm
// a very minimal instruction set.
// it has just enough operations to implement a recursive
// fibonacci function - what a coincidence :D
// NOTE: in my VM, i don't use an `enum`.
// this is just for simplicity.
#[derive(Clone, Copy, Debug)]
enum Instruction {
LoadInt { dst: u8, value: i16 },
Copy { dst: u8, src: u8 },
Add { dst: u8, src1: u8, src2: u8 },