Skip to content

Instantly share code, notes, and snippets.

View RoyBellingan's full-sized avatar

Roy Bellingan RoyBellingan

View GitHub Profile
@RoyBellingan
RoyBellingan / get.cpp
Last active December 29, 2022 14:01
map for http get
#include <exception>
#include <fmt/format.h>
#include <map>
#include <source_location>
#include <string>
std::string locationFull(const std::source_location location = std::source_location::current()) {
return fmt::format("{}:{} in {}", location.file_name(), location.line(), location.function_name());
}
@RoyBellingan
RoyBellingan / VNV 22-12.sqf
Last active December 21, 2022 18:10
VNV 22-12
_object2 moveInGunner _object1;
_object38 moveInDriver _object37;
_object39 moveInTurret [_object37, [0]];
_object41 moveInDriver _object40;
_object42 moveInTurret [_object40, [0]];
_object44 moveInDriver _object43;
_object45 moveInTurret [_object43, [0]];
_marker = createMarker ["_USER_DEFINED #571431103/27/1", [8735.48,13689.1,0]];
@RoyBellingan
RoyBellingan / serverUpdate.bat
Created November 6, 2022 20:05
serverUpdate.bat
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
:: DEFINE the following variables where applicable to your install
SET A3BRANCH=233780 -beta creatordlc
:: For stable use 233780 -beta
:: For Dev use 233780 -beta development
:: Note, the missing qotation marks, these need to be wrapped around the entire "+app_data......"
@RoyBellingan
RoyBellingan / main.cpp
Last active November 5, 2022 12:48
Jsonic vs the world
#include <boost/json.hpp>
#include <QDebug>
#include <QElapsedTimer>
#include <QFile>
#include "jsonic.c"
#include "jsonic.h"
#include "fmt/format.h"
@RoyBellingan
RoyBellingan / LPS25H.cpp
Last active July 5, 2022 14:04
LPS25H.cpp
/*
To autostart
crontab -e
* * * * * cd "/wherever you put the file/" && ./FILE_NAME
(to kill use killall logger)
To compile you will need
i2c-tools
@RoyBellingan
RoyBellingan / fmt.cpp
Created July 5, 2022 10:05
Custom Formatter
#include <fmt/color.h>
#include <fmt/format.h>
#include <iostream>
struct X {
int id;
uint8_t r{1};
uint8_t g{2};
uint8_t b{3};
};
@RoyBellingan
RoyBellingan / rotary.ino
Last active July 1, 2022 10:57
Rotary Encoder, skipping arduino logic and using low level OS call to keep up with high interrupt rate
#include "Arduino.h"
constexpr double thickPerTurn = 1200;
constexpr double wheelCircum = 0.09538 * 3.14159265359; //in meter
constexpr double ticksDistance = wheelCircum / thickPerTurn;
//write also wheel tick for debug and calibration
constexpr int LCDPrintTick = true;
//which pin to use for reset
@RoyBellingan
RoyBellingan / LPS22HB.c
Last active June 24, 2022 12:48
Raspberry pi sensor hat temperature and pressure logger
/*
To autostart
crontab -e
* * * * * cd "/wherever you put the file/" && ./FILE_NAME
*/
#include "LPS22HB.h"
#include <bcm2835.h>
#include <math.h>
@RoyBellingan
RoyBellingan / ReasonableImageGallery.php
Created May 28, 2022 17:24
ReasonableImageGallery.php
<meta name="viewport" content="width=device-width, initial-scale=0.5">
<style>
html,body {
text-size-adjust: none;
-webkit-text-size-adjust: none;
-moz-text-size-adjust: none;
-ms-text-size-adjust: none;
font-size:30px;
}
#include "enum.h" //this is https://github.com/aantron/better-enums https://raw.githubusercontent.com/aantron/better-enums/master/enum.h
#include "fmt/format.h"
#include <fmt/ranges.h> //of course remember to link -lmft
#include <vector>
BETTER_ENUM(Channel, int,
Red = 1,
Green = 1 << 2,
Blue = 1 << 3,