Skip to content

Instantly share code, notes, and snippets.

View oclero's full-sized avatar

Olivier Cléro oclero

View GitHub Profile
@oclero
oclero / CppBinaryOperationsCheatsheet.md
Created January 3, 2022 10:28
C++ Binary Operations Cheatsheet

C++ Binary Operations Cheatsheet

Values

Base 10 Base 2
0 0b
1 1b
2 10b
3 11b
@oclero
oclero / CppIteratorsCheatsheet.md
Created January 3, 2022 10:03
C++ Iterators Cheatsheet

C++ Iterators Cheatsheet

Iterator categories

  • Input Iterator (immutable): once, forward, read-only
  • Output Iterator (mutable): once, foward, write-only
  • Forward Iterator (mutable): forward, read/write
  • Bidirectionnal Iterator (mutable): forward/backwards, read/write
  • Random Access Iterator (mutable): jump around, read/write
  • Contiguous Iterator:
@oclero
oclero / CppConstructorsCheatsheet.md
Last active January 3, 2022 09:24
C++ Constructors Cheatsheet

C++ Constructors Cheatsheet

Legend:

  • 3️⃣ Rule of 3: if a class implements any of these 3 methods, it should implement all 3 of them. The goal is to ensure the correct management of the class member data.
  • 5️⃣ Rule of 5: extension of Rule of 3. Allows for optimized usage (no copies) of the class.

0️⃣ Rule of 0: These constructors and operators are not require when you don't declare any of them and make usage of existing types that support the appropriate copy/move semantics.

It's the rule of "All or Nothing".

@oclero
oclero / PrintSizesInPixels.md
Last active February 22, 2022 14:02
Print sizes in pixels (cheatsheet)

Print sizes in pixels

Portrait

Sizes are displayed as: Width * Height, both in pixels, unless specified otherwise.

Format 150dpi 300dpi 600dpi 1200dpi
A5 (148 * 210 mm) 877 * 1240 1754 * 2480 3508 * 4960 7016 * 9920
A4 (210 * 297 mm) 1240 * 1754 2480 * 3508 4960 * 7016 9920 * 14032
@oclero
oclero / BitwardCliCheatsheet.md
Created December 10, 2021 09:55
Bitwarden CLI Cheatsheet

Bitwarden CLI Cheatsheet

Copy password to clipboard

bw get password github | Set-Clipboard
@oclero
oclero / CMakeMtUtils.md
Created December 8, 2021 15:27
CMake utility for mt.exe (Windows)
# Find mt.exe and creates executable target 'Win10::Mt'.
function(find_mt)
  set(MT_TARGET_NAME Win10::Mt)

  if(NOT TARGET ${MT_TARGET_NAME})
    find_program(MT_TARGET_EXE
      NAME "mt.exe"
      PATHS "C:/Program Files (x86)/Windows Kits/10/bin/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}/${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}"
      NO_DEFAULT_PATH
@oclero
oclero / MacOsTerminalUtilities.md
Created December 6, 2021 16:42
MacOS Terminal Utilities

MacOS Terminal Utilities

Get OS version

sw_vers

Output:

ProductName: Mac OS X
@oclero
oclero / CreateFontSubset_English.sh
Last active November 21, 2021 16:09
Create font subsets
pip install fonttools brotli zopfli
pyftsubset "your-font.otf" --output-file="your-font-subset.woff2" --flavor=woff2 --layout-features="kern,liga,clig,calt,ccmp,locl,mark,mkmk,onum,pnum,smcp,c2sc,frac,lnum,tnum,subs,sups, cswh,dlig,ss01,ss03,zero" --unicodes="U+0000-00A0,U+00A2-00A9,U+00AC-00AE,U+00B0-00B7,U+00B9-00BA,U+00BC-00BE,U+00D7,U+00F7,U+2000-206F,U+2074,U+20AC,U+2122,U+2190-21BB,U+2212,U+2215,U+F8FF,U+FEFF,U+FFFD"
@oclero
oclero / ButtonShadowBehavior.cpp
Last active November 17, 2021 13:26
QPushButton shadow
#include "ButtonShadowBehavior.hpp"
#include <QAbstractButton>
#include <QtWidgets/QGraphicsDropShadowEffect>
#include <QState>
#include <QStateMachine>
#include <QSignalTransition>
#include <QParallelAnimationGroup>
#include <QVariantAnimation>
@oclero
oclero / AddSublimeTextToContextMenu.reg
Created November 10, 2021 16:36
How To Add "Open with Sublime Text" To Windows Context Menu
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\Edit with Sublime Text]
@="Edit with &Sublime Text"
"Icon"="C:\\Program Files\\Sublime Text\\sublime_text.exe,0"
"MuiVerb"="Edit with Sublime Text"
[HKEY_CLASSES_ROOT\*\shell\Edit with Sublime Text\command]
@="C:\\Program Files\\Sublime Text\\sublime_text.exe \"%1\""