Skip to content

Instantly share code, notes, and snippets.

View idfumg's full-sized avatar

Artem Pushkin idfumg

  • Sirena-Travel
  • Moscow, Russia
View GitHub Profile
#include <cstdio>
#include <cstdlib>
#include <sys/epoll.h>
#include <libudev.h>
#include <string.h>
enum class DeviceAction : std::size_t {
Added = 0,
Removed
};
/*!
* Copyright (C) 2017-2018 Andreas Hollandt
*
* Distributed under the Boost Software License, Version 1.0.
* See copy at http://boost.org/LICENSE_1_0.txt.
*/
#pragma once
#include <exception>
@idfumg
idfumg / random_numbers_and_strings.cpp
Last active September 11, 2021 10:57
The snippet for generating random numbers, strings and matrices for a simple stress testing.
#include <vector>
#include <string>
#include <random>
#include <iostream>
#define _0_9 "0123456789"
#define _A_Z "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define _a_z "abcdefghijklmnopqrstuvwxyz"
#define _ALNUMS _0_9 _A_Z _a_z
@idfumg
idfumg / segment_tree.cpp
Created September 21, 2021 17:28
Segment Tree With Lazy Propagation
#include <bits/stdc++.h>
using namespace std;
using i32 = std::int32_t;
const int INF = 1e9 + 7;
class RangeSlow {
public:
vector<i32> arr;
@idfumg
idfumg / git_submodules.md
Created May 4, 2022 15:57 — forked from gitaarik/git_submodules.md
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:

  • You can separate the code into different repositories.
@idfumg
idfumg / 0-go-os-arch.md
Created September 30, 2022 10:55 — forked from asukakenji/0-go-os-arch.md
Go (Golang) GOOS and GOARCH

Go (Golang) GOOS and GOARCH

All of the following information is based on go version go1.17.1 darwin/amd64.

GOOS Values

GOOS Out of the Box
aix
android
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2013 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
#include <concepts>
#include <vector>
#include <cassert>
#include <iostream>
using namespace std;
template <typename T>
concept Comparable = requires (T a, T b) {
{a < b} -> std::convertible_to<bool>;
package main
import (
"cmp"
"fmt"
)
func compare[T cmp.Ordered](a T, b T) bool {
return a > b
}
from typing import TypeVar, Any, Protocol, Sequence, Generic
class Comparable(Protocol):
def __lt__(self, param: Any) -> bool:
...
def __gt__(self, param: Any) -> bool:
...