Skip to content

Instantly share code, notes, and snippets.

View leha-bot's full-sized avatar
🐝
"Then" (c). I may be slow to respond, sorry about this.

Alex leha-bot

🐝
"Then" (c). I may be slow to respond, sorry about this.
View GitHub Profile
@tilkinsc
tilkinsc / main.cpp
Last active June 30, 2024 08:24
WGL Full Demo
/**
*
* MIT License
*
* Copyright (c) 2017-2022 Cody Tilkins
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@rounk-ctrl
rounk-ctrl / Dark.md
Last active June 18, 2024 18:31
Win32 Dark Mode

Dark Mode APIs.

API Signatures.

ShouldAppsUseDarkMode()

Checks whether system is using dark mode or not.
Signature:

using fnShouldAppsUseDarkMode = bool (WINAPI*)(); // ordinal 132

AllowDarkModeForWindow(In HWND hWnd, In bool allow)

@oquenchil
oquenchil / cc_static_library.bzl
Created October 6, 2021 12:55
Example cc_static_library.bzl
"""Provides a rule that outputs a monolithic static library."""
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
TOOLS_CPP_REPO = "@bazel_tools"
def _cc_static_library_impl(ctx):
output_lib = ctx.actions.declare_file("{}.a".format(ctx.attr.name))
output_flags = ctx.actions.declare_file("{}.link".format(ctx.attr.name))
@oofnikj
oofnikj / answerfile
Last active July 6, 2024 00:10
Install Docker on Termux
KEYMAPOPTS="us us"
HOSTNAMEOPTS="-n alpine"
INTERFACESOPTS="auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
hostname alpine
"
TIMEZONEOPTS="-z UTC"
@ppoffice
ppoffice / README.md
Last active July 2, 2024 09:45
Install Visual Studio Code (actually code-server) on Android
  1. Install Termux, an Android terminal emulator that provides a Linux execution environment and various tools.

  2. Update system packages in Termux:

    $ pkg update -y
@Nekrolm
Nekrolm / cpp14_traits_3.md
Last active August 25, 2020 21:45
cpp14_17_traits_part3

C++14/17 type_traits Часть 3.

В предыдущей серии мы изобретали нечто, называемое XXX_traits, где под XXX скрывается какой-то концепт. А сам трейт описывает, какие операции доступны для типов, реализующих данный концепт. И все взаимодействие с шаблонными параметрами происходило с помощью вспомогательной структуры.

template <class T, class S>
auto accumulate(const std::vector<T>& arr, S&& op) 
    -> RESULT<T>::REQUIRES<SummatorTraits<S>::value> {
    using STraits = SummatorTraits<S>;
@LFriede
LFriede / a_install-old-qt-versions.md
Last active May 25, 2024 23:51
How to trick "Qt Maintenance Tool" to install old versions

How to trick "Qt Maintenance Tool" to install old versions

tl;dr

Use a software like mitmproxy to modify the (https)-request to iapi.qt.io/api/v2/repositories so it's response lists the old Qt directorys that are still on the servers.

If you never used mitmproxy before here is the guide that shows you how it's done.

/*
c++: 17
deps:
- org.sw.demo.jtv.pqxx
- org.sw.demo.apolukhin.magic_get
*/
#include <boost/pfr/precise/core.hpp>
#include <pqxx/pqxx>
@Nekrolm
Nekrolm / cpp14_traits_2.md
Last active August 25, 2020 21:45
cpp14_traits_part2

C++14/17 type_traits Часть 2.

В предыдущей серии мы пытались сделать нечто, напоминающее проверку концепции C++20 средствами C++14/17.

У нас была функция sum, от типов аргументов которой мы требовали применимости операции +. И выглядело в конечном итоге это так:

template<typename T>
auto sum(T a, T b) -&gt; RESULT::REQUIRES&gt; {
@Nekrolm
Nekrolm / cpp14_traits.md
Created December 19, 2019 16:10
cpp14_17_traits part1

C++14/17 type_traits (пока нет concepts)

Подходит к концу 2019 год. Уже скоро C++20 станет доступен во всей своей красе. Но совсем не скоро он плотно войдет в мир промышленной разработки (сюда еще даже C++14 не везде дошел).

В С++20 появятся концепции/типажи (concepts) -- долгожданная горсть синтаксического сахара, призванная дать разработчикам возможность писать шаблоны (templates), накладывая ограничения на их параметры так, чтоб потом не было мучительно больно.

Зачем вообще накладывать ограничения?

Допустим, у нас есть такой простенький шаблон