This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <memory> | |
#include <vector> | |
// Breaking Dependencies - C++ Type Erasure - The Implementation Details - Klaus Iglberger CppCon 2022 | |
// https://www.youtube.com/watch?v=qn6OqefuH08 | |
struct Circle { | |
public: | |
explicit Circle(double rad) : radius{rad} {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.reddit.com/r/cpp/comments/11rzncu/clean_code_horrible_performance_and_the_forgotten/ | |
// https://quick-bench.com/q/mW30pqwTvtWZ-aT6COu1oiUycYc | |
#include <cmath> | |
#include <cstdlib> | |
#include <cstddef> | |
#include <ctime> | |
#include <memory> | |
#include <variant> | |
#include <vector> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <arpa/inet.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <sys/socket.h> | |
#include <unistd.h> | |
#include <iostream> | |
using namespace std; | |
// Defining Port, Note that port is same on which server is listening and on | |
// which we want to connect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.10) | |
project(StoreRLValue) | |
add_executable( | |
${PROJECT_NAME} | |
main.cpp | |
) | |
set_target_properties( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <functional> | |
#include <iostream> | |
// https://www.youtube.com/watch?v=eG5suWcHI8M | |
// Lightning Talk: FINALLY - The Presentation You've All Been Waiting For - Louis Thomas - CppCon 2021 | |
class Finally { | |
public: | |
std::function<void()> m_action; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
template <class T, class U, class V> | |
struct Foo { | |
T bar; | |
std::vector<U> baz; | |
V foobar; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 }; }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()}") |
NewerOlder