Skip to content

Instantly share code, notes, and snippets.

View jansen44's full-sized avatar
🐋

Jansen Saunier jansen44

🐋
View GitHub Profile
@jansen44
jansen44 / Makefile
Created May 24, 2025 22:58
Generic Example Makefile
PROJECT =
CC = gcc
CFLAGS =
LIBS =
BUILD_DIR = build
OBJ_DIR = $(BUILD_DIR)/obj
BIN = $(BUILD_DIR)/$(PROJECT)
@jansen44
jansen44 / memory_alignment.c
Created July 17, 2024 15:22
Memory Alignment and Padding demo in C
// REQUIRES C11>
#include <stdalign.h>
#include <stdbool.h>
#include <stdio.h>
#define ALIGN_SIZE_OF(name, x) \
(printf("%s => Alignof: %ld // Sizeof: %ld\n", name, alignof(x), sizeof(x)))
#define MEMBER_ADDRESS(member, parent) \
@jansen44
jansen44 / google_oauth_refresh.py
Last active January 30, 2024 02:42
Load Oauth access tokens from google cloud credentials.
"""
References:
- https://developers.google.com/identity/protocols/oauth2/web-server
- https://developers.google.com/drive/api/reference/rest/v3
- https://stackoverflow.com/questions/10827920/not-receiving-google-oauth-refresh-token
- https://www.youtube.com/watch?v=9HHd3IWI5Jg
1 - curl -L \
--data "access_type=offline" \
--data "client_id=" \
let gData;
function fetchData() {
fetch("https://date.nager.at/api/v3/PublicHolidays/2024/BR")
.then((r) => r.json())
.then((result) => {
gData = result;
processData();
})
.catch((e) => console.log("Error fetching data:", e));
@jansen44
jansen44 / config.lua
Last active November 25, 2022 20:21
LunarVim Config
-- General LunarVim configs
lvim.log.level = "warn"
lvim.format_on_save = true
lvim.colorscheme = "nightfly"
-- lvim.transparent_window = true
-- VIM Options
vim.opt.shiftwidth = 2
vim.opt.tabstop = 2
vim.opt.relativenumber = true
@jansen44
jansen44 / gen.sh
Created September 1, 2022 00:19
Generate simple RSA key pair with openssl
# If on MacOS, make sure that you're using openssl and not libressl, which is the
# default installed with MacOS.
# If using LibreSSL:
#
# brew install openssl
# echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.zshrc # instead of .zshrc,
# # use the respective
# # to your shell session.
PRIVATE_KEY_OUTPUT=private_key.pem
boardrev=0x1101
sromrev=11
boardtype=0x073e
vendid=0x14e4
devid=0x43ba
macaddr=00:90:4c:0d:f4:3e
ccode=0
use wgpu;
use winit;
const WINDOW_TITLE: &str = "Window";
const WINDOW_SIZE: (u32, u32) = (1280, 720);
#[async_std::main]
async fn main() {
// Window Stuff ================================================================================
let event_loop = winit::event_loop::EventLoop::new();
use winit;
const WINDOW_TITLE: &str = "Window";
const WINDOW_SIZE: (u32, u32) = (1280, 720);
fn main() {
let event_loop = winit::event_loop::EventLoop::new();
let _w_builder = winit::window::WindowBuilder::new()
.with_title(WINDOW_TITLE)
.with_inner_size(winit::dpi::PhysicalSize::new(WINDOW_SIZE.0, WINDOW_SIZE.1))
@jansen44
jansen44 / Main.hs
Created September 23, 2020 06:21
Haskell Music
-- THIS CODE IS NOT MINE! I got it from https://github.com/tsoding/haskell-music which
-- has an awesome youtube channel about haskell and functional programming, please check his content!
-- This is here just for learning purposes!
-- In order to make it run you'll need to have ffplay installed (usually downloaded alongside ffmpeg)
import qualified Data.ByteString.Lazy as B
import qualified Data.ByteString.Builder as B
import Data.Foldable
import Data.List
import System.Process