Skip to content

Instantly share code, notes, and snippets.

@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.

@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
@mbinna
mbinna / effective_modern_cmake.md
Last active November 17, 2025 12:30
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

@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/")
<!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();
@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) {
@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}
@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))) +
@VRlabBuaa
VRlabBuaa / rotationMatrixIrving.c++
Last active February 19, 2019 18:15
rotationMatrixIrving
void jacobiRotate(Matrix3d &A, Matrix3d &R, int p, int q)
{
if (A(p, q) == 0.0)
return;
double d = (A(p, p) - A(q, q)) / (2.0*A(p, q));
double t = 1.0 / (fabs(d) + sqrt(d*d + 1.0));
if (d < 0.0)
t = -t;
double c = 1.0 / sqrt(t*t + 1);
double s = t*c;
@sebble
sebble / stars.sh
Last active October 27, 2025 01:21
List all starred repositories of a GitHub user.
#!/bin/bash
USER=${1:-sebble}
STARS=$(curl -sI https://api.github.com/users/$USER/starred?per_page=1|egrep '^Link'|egrep -o 'page=[0-9]+'|tail -1|cut -c6-)
PAGES=$((658/100+1))
echo You have $STARS starred repositories.
echo