Skip to content

Instantly share code, notes, and snippets.

@cristianadam
cristianadam / PPP3.md
Created April 19, 2024 11:12
Programming: Principles and Practice Using C++, 3rd Edition - PDF watermarking woes

informit.com after buying the Book is adding watermarking in the pdf and epub files.

As it turns out the saving of the new pdf is compressing the images with jpeg instead of deflate (zip).

Consider the sample pdf and the watermarked pdf.

sample-chapter-vs-book

🤦🏻‍♂️

@cristianadam
cristianadam / bundle_static_library.cmake
Created January 17, 2020 00:30
CMake function which bundles multiple static libraries into one
# MIT License
#
# Copyright (c) 2019 Cristian Adam
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
@cristianadam
cristianadam / build_qmake.yml
Last active September 9, 2023 10:56
GitHub Actions Doxygen Qt Creator plugin QMake build matrix
name: QMake Build Matrix
on: [push]
env:
QT_VERSION: 5.14.0
QT_CREATOR_VERSION: 4.11.0
PLUGIN_PRO: doxygen.pro
PLUGIN_NAME: Doxygen
@cristianadam
cristianadam / libcpp_stdtypes.py
Created July 27, 2023 10:15
Python 2 compatible libcpp_stdtypes.py for Qt Creator 11.0.0
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
from stdtypes import qdump__std__array, qdump__std__complex, qdump__std__once_flag, qdump__std__unique_ptr, qdumpHelper__std__deque__libcxx, qdumpHelper__std__vector__libcxx
from utils import DisplayFormat
from dumper import Children, DumperBase
def qform__std____1__array():
return [DisplayFormat.ArrayPlot]
@cristianadam
cristianadam / download_qt6.cmake
Last active February 13, 2023 17:55
CMake script to download qt6 snapshots and examples. Just need to run cmake -P download_qt6.cmake. Tested on Windows, Linux, macOS.
set(qt_version 6.4.2)
string(REPLACE "." "" qt_version_dotless "${qt_version}")
if (WIN32)
set(url_os "windows_x86")
set(qt_package_arch_suffix "win64_msvc2019_64")
set(qt_dir_prefix "${qt_version}/msvc2019_64")
set(qt_package_suffix "-Windows-Windows_10_21H2-MSVC2019-Windows-Windows_10_21H2-X86_64")
elseif(APPLE)
set(url_os "mac_x64")
@cristianadam
cristianadam / 7z-macos-win-vs-native-benchmark.md
Created January 6, 2023 09:03
7z b on Apple M1 Max with Windows Arm64 VM and macOS native

Windows VM running under UMT

PS C:\Program Files\7-Zip> ./7z b
7-Zip 22.01 (arm64) : Copyright (c) 1999-2022 Igor Pavlov : 2022-07-15
Windows 10.0 22621
ARM64 0 0.0 cpus:8 128T f:1804EB8C1004
LE
1T CPU Freq (MHz):  2983  2818  3036  2990  3024  2985  3011
4T CPU Freq (MHz): 359% 2797   378% 2850
@cristianadam
cristianadam / setup_android.cmake
Last active July 21, 2022 12:55
CMake script to download OpenJDK and Android Command Line Tools. Execute with: cmake -P setup_android.cmake
# CMake script to download OpenJDK and Android Command Line Tools.
# Execute with: cmake -P setup_android.cmake
# Tested with Qt 6.3.1 and Qt Creator 8.0
set(JDK_VERSION "11.0.9.1+1")
set(ANDROID_CMDTOOLS_VERSION "8092744")
set(ANDROID_PLATFORM "android-31")
set(BUILD_TOOLS "31.0.0")
@cristianadam
cristianadam / CMakeLists.txt
Created July 12, 2022 16:46
Hello Google World from C++ using libcurl on Windows.
cmake_minimum_required(VERSION 3.16)
set(HUNTER_PACKAGES CURL)
set(HUNTER_CURL_CMAKE_ARGS
CMAKE_USE_SCHANNEL=ON
CMAKE_USE_OPENSSL=OFF
)
include(FetchContent)
FetchContent_Declare(SetupHunter GIT_REPOSITORY https://github.com/cpp-pm/gate)
@cristianadam
cristianadam / MS_Visual_C++_Visual_Assist.kms
Created June 24, 2022 10:50
Qt Creator 2.5.2 Visual C++ keyboard shortcuts from 2012
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE KeyboardMappingScheme>
<!-- Written by Qt Creator 2.5.2, 2012-08-18T19:03:36. -->
<mapping>
<shortcut id="QtCreator.ReturnToEditor">
<key value="Esc"/>
</shortcut>
<shortcut id="QtCreator.New">
<key value="Ctrl+N"/>
</shortcut>
@cristianadam
cristianadam / qtbase-6.3.0-win-msvc.cmake
Created June 17, 2022 10:45
Script used to compile QtBase 6.3.0 statically for Windows Arm64. First run cmake -P qtbase-6.3.0-win-msvc.cmake in a x86_64 console, then in a arm64 one.
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# Run this script on a Windows host to generate Qt binaries.
# Set the PATH environment variable to contain the locations of cmake and git.
if ("$ENV{VSCMD_ARG_TGT_ARCH}" STREQUAL "x64")
set(arch "x86_64")
elseif ("$ENV{VSCMD_ARG_TGT_ARCH}" STREQUAL "x86")
set(arch "i386")