Skip to content

Instantly share code, notes, and snippets.

View tomilov's full-sized avatar

Anatoliy V Tomilov tomilov

  • Yandex
  • Yekaterinburg
View GitHub Profile
@tomilov
tomilov / vps.sh
Created November 1, 2024 09:49
Create client/server OpenVPN config pair to use in case if your provider blocks OpenVPN tunnel after it detect SSL/TLS handshake of OpenVPN
#!/usr/bin/env bash
set -xueo pipefail
IP=$1
PORT=$2
openvpn --genkey secret secret.key
trap 'rm secret.key' ERR EXIT
@tomilov
tomilov / a_minimal_example.c
Created August 1, 2024 19:12 — forked from yyny/a_minimal_example.c
GDB JIT Interface -- Minimal Example
/* I spent an entire evening getting JIT debug symbols to work in GDB.
* Here is a minimal example to get you started.
* Have fun!
*/
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@tomilov
tomilov / ssesort.cpp
Created May 9, 2024 22:56
sort unique 16 non-zero values using avx512f+avx512bw
#include <algorithm>
#include <iterator>
#include <cstdint>
#include <numeric>
#include <type_traits>
#include <bitset>
#include <cassert>
#include <random>
#include <iostream>
@tomilov
tomilov / VkFormat_regex.py
Last active February 5, 2023 21:33
full pythonic re for VkFormat
FORMAT_REGEX = re.compile(r'''
VK_FORMAT
(?:
# NVIDIA optical flow
_R16G16_S10_5_NV
|
# PVRTC
_(?P<pvrtc>PVRTC[12])
_(?P<pvrtc_bpp>[24])BPP
_(?P<pvrtc_numeric_format>UNORM|SRGB)
struct SourceCodeJsonEscape
{
const char * text;
};
template<>
struct fmt::formatter<engine::SourceCodeJsonEscape> : fmt::formatter<fmt::string_view>
{
@tomilov
tomilov / postgres_queries_and_commands.sql
Created October 13, 2022 12:48 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@tomilov
tomilov / make_sorted_box.cpp
Last active July 2, 2022 07:11
make AA box consisting of inherently sorted triangles from two points
#include <iterator>
#include <algorithm>
#include <tuple>
#include <vector>
#include <iostream>
#include <numeric>
#include <functional>
#include <random>
#include <cassert>
#include <unordered_set>
#include <list>
#include <optional>
#include <functional>
#include <utility>
#include <tuple>
#include <memory>
#include <type_traits>
#include <cstdlib>
constexpr size_t tileSize = 8;
const size_t width = ...;
const size_t height = ...;
thrust::cuda::pointer<const float3> p = ...;
assert(width % tileSize == 0);
assert(height % tileSize == 0);
thrust::cuda::vector<float3> sums;
--- c:/Users/Anatoly/Documents/Projects/Vulkan-Hpp/vulkan/vulkan.hpp 2020-05-05 20:09:03.802924000 +0500
+++ c:/VulkanSDK/1.2.135.0/Include/vulkan/vulkan.hpp 2020-04-24 11:54:44.062122600 +0500
@@ -13150,6 +13150,22 @@
return UniqueHandle<T,D>(data, deleter);
#endif
}
+
+ template <typename T, typename D>
+ VULKAN_HPP_INLINE typename ResultValueType<UniqueHandle<T,D>>::type createResultValue( Result result, T & data, char const * message, std::initializer_list<Result> successCodes, typename UniqueHandleTraits<T,D>::deleter const& deleter )
+ {