Skip to content

Instantly share code, notes, and snippets.

View tomilov's full-sized avatar

Anatoliy V Tomilov tomilov

  • Yandex
  • Yekaterinburg
View GitHub Profile
#include <optix.h>
#include <optix_stubs.h>
#include <optix_function_table_definition.h>
#include <cuda.h>
namespace Denoiser
{
static void CUDA_CHECK(CUresult result)
{
@tomilov
tomilov / git-serve.md
Created January 10, 2020 17:19 — forked from datagrok/git-serve.md
How to easily launch a temporary one-off git server from any local repository, to enable a peer-to-peer git workflow.
@tomilov
tomilov / box_triangle_intersection.plt
Last active June 29, 2022 17:41
nonagon as result of intersection of parallelotope and triangle in space
reset
set view equal xyz
unset border
unset tics
set xyplane 0
set xrange [-3:3]
set yrange [-3:3]
set zrange [-3:3]
$cube << EOI
@tomilov
tomilov / ddp_ssp.cpp
Last active November 13, 2019 17:44
dynamic dynamic programming for subset sum problem
#include <iostream>
#include <algorithm>
#include <cassert>
struct pair
{
int term;
int sum;
pair operator + (int x)
@tomilov
tomilov / crc32c.h
Last active January 30, 2018 16:45
CRC-32C
#pragma once
#include <cstdint>
#include <x86intrin.h>
inline
std::uint32_t crc32c(const void * input, std::size_t size, std::uint32_t result = ~0)
{
auto i8 = static_cast< const std::uint8_t * >(input);
@tomilov
tomilov / ssh-telegram.sh
Created September 29, 2017 19:51 — forked from matriphe/ssh-telegram.sh
Bash Script to notify via Telegram Bot API when user log in SSH
# save it as /etc/profile.d/ssh-telegram.sh
# use jq to parse JSON from ipinfo.io
# get jq from here http://stedolan.github.io/jq/
USERID="<target_user_id>"
KEY="<bot_private_key>"
TIMEOUT="10"
URL="https://api.telegram.org/bot$KEY/sendMessage"
DATE_EXEC="$(date "+%d %b %Y %H:%M")"
TMPFILE='/tmp/ipinfo-$DATE_EXEC.txt'
if [ -n "$SSH_CLIENT" ]; then
@tomilov
tomilov / stream.js
Created April 23, 2017 18:27 — forked from padenot/stream.js
How to serve media on node.js
var http = require('http');
var path = require('path');
var fs = require('fs');
var AUDIOFILE = "./audio.ogg";
function serveWithRanges(request, response, content) {
var range = request.headers.range;
var total = content.length;
var parts = range.replace(/bytes=/, "").split("-");
#include <boost/preprocessor/seq/for_each_i.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#include <utility>
#include <cstddef>
namespace details
{
#include <type_traits>
#include <utility>
template< std::size_t index, typename type >
struct ref { type & value; };
template< std::size_t index, typename type >
type && get(ref< index, type > const & r)
{
return std::forward< type >(r.value);
@tomilov
tomilov / gcc.cpp
Created November 12, 2016 22:09
array to template arguments
#include <type_traits>
#include <utility>
#include <iterator>
#include <typeinfo>
#include <memory>
#include <mutex>
#include <string>
#include <cxxabi.h>