Skip to content

Instantly share code, notes, and snippets.

View htoik's full-sized avatar

Henrik Toikka htoik

View GitHub Profile
@htoik
htoik / install_octoprint.sh
Created August 31, 2025 10:55
Install OctoPrint on Ubuntu 24.04
#!/bin/bash
sudo apt update && sudo apt upgrade -y
sudo apt install -y python3 python3-venv python3-pip python3-dev git libffi-dev libusb-dev libyaml-dev build-essential
# Create user for octoprint and switch to it
sudo useradd -m octoprint
sudo passwd octoprint
sudo usermod -aG dialout octoprint
sudo chsh -s /bin/bash octoprint
sudo su - octoprint
@htoik
htoik / trianglefill_and_stuff.cpp
Created March 25, 2022 05:57
Triangle fill and line draw algorithms with SDL2 using SDL_Surface
// Untested code, but should work with some tweaks (more or less)
struct Point{
double x, y;
};
struct Line{
Point p1, p2;
};
// to keep my sanity heres a simplified version of a texture demo for my future self
// original from: github.com/progschj/OpenGL-Examples/blob/master/03texture.cpp
#define GL_GLEXT_PROTOTYPES
#include <GLFW/glfw3.h>
#include <iostream>
#include <string>
#include <vector>
@htoik
htoik / fontcaching.cpp
Created December 31, 2021 17:47
Simple Text rendering system for OpenGL with GLFW using SDL_ttf and font caching with demo
/* Declarations */
#include <GLFW/glfw3.h>
#include <SDL2/SDL_ttf.h>
#include <string>
class Font{
public:
Font(const char* filename, int resolution);
void RenderText(std::string text, double x, double y, double textHeight, SDL_Color color);