Skip to content

Instantly share code, notes, and snippets.

View Sir-Photch's full-sized avatar
🎯
Focusing

Christoph Sir-Photch

🎯
Focusing
View GitHub Profile
@Sir-Photch
Sir-Photch / gpumeter.sh
Last active October 24, 2024 13:31 — forked from fpaupier/gpumeter.sh
Measure maximum VRAM consumption of a program on linux for Nvidia devices
#!/bin/bash
if [ "$#" -lt 1 ]; then
echo "Usage: $0 executable [args...]"
exit 1
fi
# Start monitoring GPU memory usage in the background
nvidia-smi --query-gpu=memory.used --format=csv,noheader,nounits -l 1 > gpu_usage.log &
PID=$!
@Sir-Photch
Sir-Photch / dumbsad.cpp
Last active July 25, 2024 09:41
Simple parallelized sum of absolute differences (SAD) stereo matching implementation
#include <cstdint>
#include <opencv2/core.hpp>
#include <opencv2/core/base.hpp>
#include <opencv2/core/hal/interface.h>
#include <opencv2/core/matx.hpp>
#include <opencv2/core/types.hpp>
#include <opencv2/core/utility.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>
#include <iostream>
@Sir-Photch
Sir-Photch / .clang-format
Last active April 22, 2024 10:31 — forked from YodaEmbedding/.clang-format
.clang-format for Rust style (rustfmt)
AccessModifierOffset: -2
AlignAfterOpenBracket: BlockIndent # New in v14. For earlier clang-format versions, use AlwaysBreak instead.
AlignConsecutiveMacros: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: DontAlign
AlignOperands: false
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
@Sir-Photch
Sir-Photch / Dockerfile
Created May 11, 2023 12:29
AArch64 Raspberry Pi OS Dockerfile
ARG DEBIAN_FRONTEND=noninteractive
FROM busybox:latest
ADD https://downloads.raspberrypi.org/raspios_lite_arm64/root.tar.xz /
RUN set -xeu && \
mkdir "/rpi-root" && \
tar xaf /root.tar.xz -C /rpi-root
@Sir-Photch
Sir-Photch / dyndns.py
Last active February 17, 2023 12:11
Python script to update A root ("@") record with hetzner dns
#!/usr/bin/env python3
import requests
import json
import os
from http.client import responses
token = os.environ.get("HETZNER_API_TOKEN") # abc123
zone_name = os.environ.get("HETZNER_DYNDNS_ZONE") # "mydomain.com"
ntfy_topic = os.environ.get("HETZNER_NTFY_TOPIC") # ntfy.sh/... my_topic_name
@Sir-Photch
Sir-Photch / Sarcasm.c
Last active October 12, 2024 23:24
Sarcasm.c | cLiPbOaRd GeNeRaToR fOr SaRcAsM tExT
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
int main(void)
{
if (!OpenClipboard(NULL))
{
using System;
using System.Linq;
using System.IO;
using System.Drawing;
using System.Collections.Generic;
namespace ImageConverter
{
class Program
{