Skip to content

Instantly share code, notes, and snippets.

View sy6sy2's full-sized avatar

Sylvain CECCHETTO sy6sy2

  • Cyber-Detect
  • Nancy, France
View GitHub Profile
@sy6sy2
sy6sy2 / .docker_aliases.sh
Created December 9, 2021 12:18
Useful docker and docker compose aliases
# ------- Useful docker and docker compose aliases --------
#
# (inspired by https://gist.github.com/jgrodziski/9ed4a17709baad10dbcd4530b60dfcbb)
#
# # Usage:
# dc : docker compose
# dcu : docker compose up -d
# dcb : docker compose build
# dcub : docker compose up -d --build
# dcd : docker compose down
@sy6sy2
sy6sy2 / cpp-style-guide.md
Last active July 1, 2020 06:46
[C++ Style Guide] #CPP

C++ Style Guide

Disclaimer

There is no "official" C++ style guide. This one is my C++ style, that's all.

File extensions

  • Source files: .cpp
  • Header files: .hpp
@sy6sy2
sy6sy2 / cpp-snippets.md
Last active August 19, 2020 08:44
[C++ snippets] #CPP

C++ snippets

Measure elapsed time

#include <chrono>

auto start = std::chrono::steady_clock::now();

 //
@sy6sy2
sy6sy2 / cpp-const-keyword.md
Last active June 10, 2020 10:33
[C++ const keyword] #CPP

C++ const keyword

Use const whenever possible.

Constant variable

If you make any variable as constant, using const keyword, you cannot change its value. Also, the constant variables must be initialized while they are declared.

Pointer with const keyword

@sy6sy2
sy6sy2 / cpp-static-keyword.md
Last active June 9, 2020 15:24
[C++ static keyword] #CPP

C++ static keyword

Static variable inside function

Static variables when used inside function are initialized only once, and then they hold there value even through function calls. These static variables are stored on static storage area , not in stack.

Static class objects

Static keyword works in the same way for class objects too. Objects declared static are allocated storage in static storage area, and have scope till the end of program.