Skip to content

Instantly share code, notes, and snippets.

@cristianadam
cristianadam / configure.cmake
Created August 1, 2024 11:50
configure.cmake
if (CMAKE_ARGC LESS 4)
message("Usage cmake -P " ${CMAKE_ARGV2} " <platform e.g. gcc;cosmo> \"<module;list>\"")
return()
endif()
if(CMAKE_ARGV3 STREQUAL "cosmo")
set(ENV{PATH} $ENV{HOME}/Projects/cosmopolitan/repo/cosmocc/bin:$ENV{PATH})
set(extra_config
--toolchain ${CMAKE_CURRENT_LIST_DIR}/cosmo.cmake
-DQT_HOST_PATH=${CMAKE_CURRENT_LIST_DIR}/install-gcc
@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 / 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 / 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 / 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")
@cristianadam
cristianadam / qt-6.3.0-win-msvc.cmake
Created June 15, 2022 22:44
Script used to compile Qt 6.3.0 statically for Windows Arm64. First run cmake -P qt-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")
@cristianadam
cristianadam / Go5G-7zip-benchmark.md
Created December 19, 2021 19:18
7zip benchmark on a Samsung Galaxy Book Go 5G x86, x86_64, arm64 and wsl2 linux arm64

Arm64


7-Zip 21.06 (arm64) : Copyright (c) 1999-2021 Igor Pavlov : 2021-11-24

Windows 10.0 22000
ARM64 0 805.D0E cpus:8 128T f:804EB8C1004
LE 
@cristianadam
cristianadam / 7zip-benchmark.txt
Created November 4, 2021 10:01
7zip benchmark on a Samsung Galaxy Book Go x86, x86_64 and arm64.
C:\Program Files (Arm)\7-Zip>7z b
7-Zip 21.04 beta (arm64) : Copyright (c) 1999-2021 Igor Pavlov : 2021-11-02
Windows 10.0 22000
ARM64 0 805.D0E cpus:8 128T f:804EB8C1004
LE
1T CPU Freq (MHz): 1931 2549 2550 2493 2488 2549 2545
4T CPU Freq (MHz): 346% 1903 354% 1952