Skip to content

Instantly share code, notes, and snippets.

View vladiant's full-sized avatar
🏠
Working from home

Vladislav Antonov vladiant

🏠
Working from home
View GitHub Profile
@vladiant
vladiant / Makefile
Created July 10, 2021 22:12
C++20 Hello World Module
main : main.o hello.o
g++-11 -o main main.o hello.o
main.o : main.cpp gcm.cache/smd.hello.gcm
g++-11 -fPIC -fmodules-ts -std=c++20 -o main.o -c main.cpp
hello.o: hello.cpp
g++-11 -fPIC -fmodules-ts -std=c++20 -o hello.o -c hello.cpp
gcm.cache/smd.hello.gcm: hello.o
@vladiant
vladiant / qa-warnings.cmake
Created August 14, 2021 19:18
C++ compiler flags
# NOTE: all useful flags for up to GCC 8.1 and Clang 7.0 were added (not included into -Wall -Wextra)
# * https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
# * https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html
# * https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html
# * https://clang.llvm.org/docs/DiagnosticsReference.html
set(qa_warn)
set(qa_c_warn)
set(qa_cxx_warn)
@vladiant
vladiant / client.py
Created August 14, 2021 20:57
Python DBus
#!/usr/bin/env python3
import dbus
class Client:
def __init__(self):
bus = dbus.SessionBus()
service = bus.get_object("com.example.service", "/com/example/service")
self._message = service.get_dbus_method(
@vladiant
vladiant / compile_time_check_user_literals.cpp
Created November 17, 2021 18:31
Compile time checking user defined literals
// With friendly permission of BENOCS GmbH (www.benocs.com)
// https://www.youtube.com/watch?v=KmoTKz95Wsg
// https://godbolt.org/z/73vT1bE86
#include <cstdio> // Needed for the print-function only!
#include <cstdint>
#include <variant>
#include <system_error>
@vladiant
vladiant / compare_ml.py
Created February 28, 2022 18:56
Compare ML algorithms
# Compare Algorithms
import pandas
import matplotlib.pyplot as plt
from sklearn import model_selection
from sklearn.linear_model import LogisticRegression
from sklearn.tree import DecisionTreeClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.naive_bayes import GaussianNB
from sklearn.svm import SVC
@vladiant
vladiant / computer_vision_perception_self_driving_cars.txt
Created March 8, 2022 21:18
Computer Vision and Perception for Self-Driving Cars (Deep Learning Course)
Computer Vision and Perception for Self-Driving Cars (Deep Learning Course)
https://www.youtube.com/watch?v=cPOtULagNnI
Python + Deep Learning
Robotics with Sakshay
https://www.youtube.com/c/roboticswithsakshay/videos
* Road Segmentation
* 2D Object Detection (yolo)
@vladiant
vladiant / downloader.py
Created March 13, 2022 12:17
imgbox.com gallery downloader
import urllib.request
import requests
from bs4 import BeautifulSoup
with open("images.txt", "r") as fp:
lines = fp.readlines()
for url in lines:
r = requests.get(url=url.strip())
print(f"URL: {url.strip()}")
@vladiant
vladiant / cpp03.cpp
Created March 21, 2022 20:42
Evolving a Nice Trick - Patrice Roy - CppCon 2021
#include <cmath>
class exact {};
class floating {};
template <class T> bool close_enough(T a, T b, exact) {
return a == b;
}
template <class T> bool close_enough(T a, T b, floating) {
return std::abs(a - b) <= static_cast<T>(0.000001);
}
struct false_type { enum { value = false }; };
@vladiant
vladiant / get_gists.py
Created March 21, 2022 20:44 — forked from leoloobeek/get_gists.py
Download all gists for a specific user
# first: mkdir user && cd user && cp /path/to/get_gists.py .
# python3 get_gists.py user
import requests
import sys
from subprocess import call
user = sys.argv[1]
r = requests.get('https://api.github.com/users/{0}/gists'.format(user))
#include <iostream>
#include <vector>
template <class T, class U, class V>
struct Foo {
T bar;
std::vector<U> baz;
V foobar;
};