Skip to content

Instantly share code, notes, and snippets.

View joseph0x45's full-sized avatar

Joseph Dogbevi joseph0x45

View GitHub Profile

Learn Go

  • The Go Programming language: Go basics and fundamentals Download link
  • Let's Go: How to write HTTP services with Go Download link

Learn about HTTP and networking

@joseph0x45
joseph0x45 / main.go
Last active March 25, 2024 11:34
Go json.Marshaler and json.Unmarshaler interfaces
package main
import (
"encoding/json"
"fmt"
"strconv"
)
func pigeonAgeToHumanYears(pigeonYears int) int {
if pigeonYears <= 1 {
@joseph0x45
joseph0x45 / index.md
Last active January 28, 2024 19:31
Bargaining with the mean voice - Dealing with failure to meet goals

8dvnd8

Have you ever failed to reach a goal you set? well most likely you have. We are humans after all and failure is built in our existence. However, we are also different in the way that we deal with such failure, regardless of that difference, I believe most of us have what I call the mean voice in our head, or have had it. I have it, from time to time, it comes up to remind me of my failures, to tell me what I could have done better. If you have such a voice in your head, I think it is a good thing, to some extent. That mean voice could be inner moral or ethical guidance that helps you make positive and righteous decisions, it could also be the result of a toxic relationship you have with yourself. Whether that is a good thing or not is yours to decide. In this post I want to talk about how I feel about that mean voice, and how I have learned to bargain with it so that we can both live together in the same body without h

@joseph0x45
joseph0x45 / pain.md
Last active January 24, 2024 13:33
Writing arithmetic operations from scratch in C: Part 1

Hello reader, this is the first article of a series where I will be trying to recreate arithmetic operations in binary using C Lets' get into the good stuff.

What the heck am I doing exactly

Well, as I said, arithmetic operations, I will start with integers first, so the goal is to have functions for every operations (addition, division, substraction and multiplication) that would take in 2 integers and return the result of the corresponding operation. The catch is that we are not allowed to use the "built in" arithmetic operations in C, meaning this

int add(int a, int b){
@joseph0x45
joseph0x45 / goals.md
Last active January 1, 2024 08:38
Learning goals

1- Finish the DSA course by Prime

2- Read 'Database design for mere mortals' : 50 pages a day

@joseph0x45
joseph0x45 / ideas.md
Created January 1, 2024 07:39
Project ideas list

1- Linkdump (A link aggregator)

2- PigeonBoard Simple kanban board (with live collaboration?)

3- Arcane A secrets management platform for dev teams

4- LiveLocalhost A simple http tunnel

5- Esmee A database

@joseph0x45
joseph0x45 / index.md
Last active June 9, 2024 11:05
How I develop my Go apps in containers using Neovim and docker compose

Hello reader. I have been trying to replicate the dev container experience that I had when I was still using vscode (I use neovim now btw) but it wasn't quite that, I tried some neovim plugins but didn't really like it. But I'm happy to tell you that I finally got something, just for Golang apps, but we are getting there. Let's quickly see how I achieved this.

Required dependencies

You will need docker and docker compose installed on your system. I use Manjaro so for me installing these two was as easy as running

pamac install docker docker-compose

Once you have these two installed you will need a text editor, I will be using neovim. What I mean by the "dev container experience" is to be able to have my code on my host, but run and debug it inside a container so that way my computer doesn't have any dependencies and I can easily reproduce the dev environment on another PC without having a "it worked on that other machine" moment. As exemple we will build a simple Go app that returns "Hello world

@joseph0x45
joseph0x45 / golang-github-oauth.md
Last active December 8, 2023 10:48
Learn how to implement Github oauth in your Golang application

Introduction

Hello reader. In this article you will learn how to implement Github oauth in your apps using Golang on the server. I will be using Sveltekit for the client app but don't worry about it because we only need it to test the backend logic. Let's dive in

How does Oauth work

First we need to understand how oauth work under the hood, for the matter I made a simple diagram

oauth

@joseph0x45
joseph0x45 / notes.md
Created October 6, 2023 10:49
CS notes
  • Formula to calculate the maximum value that can fit in an n bits signed integer MaxPositive = 2e(n-1) -1
  • Formula to calculate the maximum value that can fit in an n bits unsigned integer Max = 2e(n) - 1
@joseph0x45
joseph0x45 / certus.md
Created September 18, 2023 20:01
The Certus file format specification

Purpose

A certus file is meant to contain "pseudo code" that describes an HTTP request, that code will be parsed by the certus cli and executed.

Comments

Every line starting with a '#' will be considered as a comment and ignored.

Sending a request

The first line in a certus file (if every comment is discarded) should be the line where the user defines the HTTP method and the targetted endpoint. An exemple