Skip to content

Instantly share code, notes, and snippets.

View markaren's full-sized avatar

Lars Ivar Hatledal markaren

View GitHub Profile
@markaren
markaren / pixi.toml
Last active February 24, 2026 21:56
Robostack toml Windows/jazzy
[workspace]
name = "robostack"
description = "Development environment for RoboStack ROS packages"
channels = ["https://prefix.dev/conda-forge"]
platforms = ["linux-64", "win-64", "osx-64", "osx-arm64", "linux-aarch64"]
# This will automatically activate the ros workspace on activation
[target.win.activation]
scripts = ["install/setup.bat"]
@markaren
markaren / url_download.py
Created February 23, 2026 08:52
Downloading images on demand in Google Colab
import requests
url = "https://upload.wikimedia.org/wikipedia/en/7/7d/Lenna_%28test_image%29.png?download"
filename = "Lenna.png"
# Some websites does not allow scripts to download files
# trick website into thinking we are a browser, by adding a header
headers = {
#pragma once
#include <condition_variable>
#include <mutex>
class semaphore {
public:
explicit semaphore(unsigned int max) : count_(0), max_(max) {}
@markaren
markaren / GUIMockup.cpp
Created October 5, 2022 13:46
GUIMockup
#include <atomic>
#include <chrono>
#include <functional>
#include <iostream>
#include <mutex>
#include <queue>
#include <thread>
#include <condition_variable>
namespace {
@markaren
markaren / bubble_sort.cpp
Created November 25, 2021 10:08
Bubble sort C++
#include <iostream>
#include <vector>
namespace {
template <class T>
void sort(std::vector<T> &list) {
int n = list.size();
bool swapped;
do {
@markaren
markaren / VL53L1X_change_address.py
Last active September 7, 2021 20:23
VL53L1X_change_address
import qwiic
def change_address(old_address: int, new_address: int):
# Connect to Mux
mux = qwiic.QwiicTCA9548A()
# Initially Disable All Channels
mux.disable_all()
@markaren
markaren / gist:b3f1279e2b46b5b2c392f6086484107e
Last active September 7, 2021 20:07
Raspberry pi eduroam
echo -n password_here | iconv -t utf16le | openssl md4 // <---- run command and copy the output hash
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
network={
identity="username@ntnu.no"
password=hash:password
eap=PEAP
phase1="peaplabel=0"
phase2="auth=MSCHAPV2"
@markaren
markaren / lih.md
Last active February 26, 2022 08:16
Biography

Dr. Lars Ivar Hatledal received a B.Sc. degree in automation and an M.Sc degree in simulation and visualisation from NTNU, Ålesund, Norway, in 2013 and 2017 respectively. From 2013 to 2017 he worked as a part-time research assistant with the Intelligent System lab at NTNU Ålesund, Department of Ocean Operations and Civil Engineering. In 2021 he received a Ph.D degree from NTNU within the topic of co-simulation and is currently working as an associate professor with the Department of ICT and Natural Sciences in NTNU Ålesund. His research area includes co-simulation, 3D visualisation and software architecture.

@markaren
markaren / SimplePID.py
Last active February 17, 2020 08:36
Simple FMUPython PID controller https://github.com/NTNU-IHB/PythonFMU
from pythonfmu import Fmi2Causality, Fmi2Variability, Fmi2Slave, Real
slave_class = "SimplePID" # REQUIRED - Name of the class extending Fmi2Slave
class SimplePID(Fmi2Slave):
Fmi2Slave.author = "John Doe"
Fmi2Slave.description = "A simple PID controller"
@markaren
markaren / thread_worker.hpp
Created September 23, 2019 06:35
Reusable thread worker in C++
#include <condition_variable>
#include <functional>
#include <mutex>
#include <thread>
class thread_worker
{
public:
thread_worker();