Skip to content

Instantly share code, notes, and snippets.

@VRlabBuaa
VRlabBuaa / extractRotation.c++
Last active September 12, 2023 07:37
Extract a robust rotation matrix from an arbitray 3x3 matrix
void extractRotation(const Matrix3d &A, Quaterniond &q,
const unsigned int maxIter)
{
for (unsigned int iter = 0; iter < maxIter; iter++)
{
Matrix3d R = q.matrix();
Vector3d omega = (R.col(0).cross(A.col(0)) + R.col
(1).cross(A.col(1)) + R.col(2).cross(A.col(2))
) * (1.0 / fabs(R.col(0).dot(A.col(0)) + R.col
(1).dot(A.col(1)) + R.col(2).dot(A.col(2))) +
@gillescastel
gillescastel / Ultisnip snippets
Last active October 19, 2025 16:44
Vimtex setup
snippet template "Basic template" b
\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[dutch]{babel}
\usepackage{amsmath, amssymb}
\begin{document}
@Centrinia
Centrinia / primepi.cc
Last active June 16, 2018 05:24
Meissel Lehmer Prime Counting
/* primepi.cc */
#include <iostream>
#include <vector>
template <typename T>
inline T bitmask(const T n) __attribute__((const));
template <typename T>
inline T bitmask(const T n) {
<!DOCTYPE html>
<html>
<head><title>SOUND</title></head>
<body>
<div>Frequence: <span id="frequency"></span></div>
<script type="text/javascript">
var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
var oscillatorNode = audioCtx.createOscillator();
var gainNode = audioCtx.createGain();
@romanlarionov
romanlarionov / CMakeLists.txt
Last active August 11, 2019 17:15
OpenGL Context Creation Template
cmake_minimum_required(VERSION 2.6)
project(OpenGL_APP)
option(GLFW_BUILD_DOCS OFF)
option(GLFW_BUILD_EXAMPLES OFF)
option(GLFW_BUILD_TESTS OFF)
add_subdirectory(deps/glfw)
include_directories("deps/glfw/include"
"deps/glad/include/")
@mbinna
mbinna / effective_modern_cmake.md
Last active November 18, 2025 06:56
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@VikingPenguinYT
VikingPenguinYT / dropout_bayesian_approximation_tensorflow.py
Last active June 24, 2025 00:36
Implementing Dropout as a Bayesian Approximation in TensorFlow
import numpy as np
import tensorflow as tf
import matplotlib.pyplot as plt
from tensorflow.contrib.distributions import Bernoulli
class VariationalDense:
"""Variational Dense Layer Class"""
def __init__(self, n_in, n_out, model_prob, model_lam):
self.model_prob = model_prob
@kuviman
kuviman / RAIC.md
Last active February 24, 2020 11:38
Web Renderer for Russian AI Cup

Web renderer for Russian AI Cup

Russian AI Cup — open artificial intelligence programming contest where you can test yourself writing a game strategy! It’s simple, clear and fun! We welcome both novice programmers — students and pupils, as well as professionals. Writing your own strategy is very simple: basic programming skills are enough.

This competition was being held for the sixth time, and this time we made a game of the RTS game genre — players were controlling 500 vehicles of 5 different types at once. The task is to destroy the opponent!

CodeWars 2017

My part was to implement the web renderer — the one you see on the site. There is also a technical renderer with schematic graphics used by participants for local testing.

@enricofoltran
enricofoltran / main.go
Last active September 30, 2025 12:29
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@magnetikonline
magnetikonline / README.md
Last active November 24, 2024 15:55
Bash getopt long options with values usage example.

Bash getopt long options with values usage example

#!/bin/bash -e

ARGUMENT_LIST=(
  "arg-one"
  "arg-two"
  "arg-three"
)