Skip to content

Instantly share code, notes, and snippets.

View marc0x71's full-sized avatar
🤪

marc0x71 marc0x71

🤪
View GitHub Profile
@marc0x71
marc0x71 / watcher.sh
Last active October 22, 2024 21:44
File watcher
#!/bin/bash
normal=$(tput sgr0)
yellow=$(tput setaf 3)
green=$(tput setaf 2)
FOLDER="."
PATTERN=".*"
COMMAND="ls"
@marc0x71
marc0x71 / show_cpp_types.cc
Last active October 15, 2024 07:40
Mostra dimensione, min e max per ogni tipo base C++
#include <iostream>
#include <limits>
#include <string_view>
#include <type_traits>
template <typename T> void print_details(std::string_view type) {
std::cout << type << " | " << 8 * sizeof(T) << " | ";
if constexpr (std::is_same_v<T, char> || std::is_same_v<T, unsigned char>) {
std::cout << static_cast<int>(std::numeric_limits<T>::min()) << " | "
<< static_cast<int>(std::numeric_limits<T>::max()) << " |\n";
@marc0x71
marc0x71 / gist:076c36c1fb9ad640670ed47a020f6d02
Created June 1, 2024 21:19 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@marc0x71
marc0x71 / exec.py
Created May 8, 2024 17:57
Execute the external command in Python
import shlex
from subprocess import Popen, PIPE
def get_exitcode_stdout_stderr(cmd: str):
"""
Execute the external command and get its exitcode, stdout and stderr.
"""
args = shlex.split(cmd)
@marc0x71
marc0x71 / myclass.cpp
Created January 27, 2023 17:38
C++ Rule of Five
class myclass {
public:
myclass()=default;
myclass(const myclass &) = default;
myclass(myclass &&) = default;
myclass &operator=(const myclass &) = default;
myclass &operator=(myclass &&) = default;
~myclass() = default;
};
ColumnLimit: 120
Cpp11BracedListStyle: false
IndentWidth: 4
Standard: Auto
TabWidth: 4
UseTab: ForIndentation
@marc0x71
marc0x71 / singleton.cpp
Created December 27, 2022 09:55
Modern C++ singleton
#include <iostream>
class singleton_interface {
public:
virtual ~singleton_interface() = default;
virtual void do_something() const = 0;
};
class singleton : public singleton_interface {
public:
@marc0x71
marc0x71 / recursive_directory_finder.cpp
Created July 2, 2022 15:36
Recursive directory file finder
void filelist(const std::string& path, const std::string& match_str, std::function<void(std::string, std::string)> f) {
std::regex re(match_str);
auto it = std::filesystem::recursive_directory_iterator(path, std::filesystem::directory_options::skip_permission_denied);
auto it_end = std::filesystem::end(it);
while (it != it_end) {
try {
auto dir_entry = *it;
if (dir_entry.is_regular_file()) {
auto filename = dir_entry.path().filename().string();
auto folder = dir_entry.path().parent_path().string();
curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh
curl -sSL https://get.haskellstack.org/ | sh
@marc0x71
marc0x71 / docker.md
Last active February 20, 2021 18:21
Comandi Docker

Docker

Comandi utili

docker version

docker run hello-world

docker ps