Skip to content

Instantly share code, notes, and snippets.

@cristianadam
cristianadam / qtcreator-windows.kms
Created August 7, 2025 12:45
Windows keyboard configuration for Qt Creator to be used on macOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE KeyboardMappingScheme>
<!-- Written by Qt Creator 16.0.0, 2025-03-25T19:35:24. -->
<mapping>
<shortcut id="ProjectExplorer.RescanWorkspace"/>
<shortcut id="ProjectExplorer.ExcludeFromWorkspace"/>
<shortcut id="ResourceEditor.Refresh"/>
<shortcut id="ResourceEditor.RemoveNonExisting"/>
<shortcut id="ResourceEditor.RemovePrefix"/>
<shortcut id="ResourceEditor.RenamePrefix"/>
@cristianadam
cristianadam / karabiner.json
Created August 7, 2025 12:44
Karabiner Elements Windows like setup
{
"profiles": [
{
"complex_modifications": {
"rules": [
{
"description": "Left_Option+Left/Right => Command+Left/Right (Edge, Qt Creator)",
"manipulators": [
{
"conditions": [
@cristianadam
cristianadam / cmake generator expression refactoring.md
Last active August 7, 2025 20:38
gpt-oss-20b CMake knowledge

On a MacBook Pro with Apple Silicon I have done the following:

% brew install llama.cpp
% llama-server -hf unsloth/gpt-oss-20b-GGUF:UD-Q4_K_XL --jinja 

I have used here the default context value -c 4096.

Then opened a webbrowser at localhost:8080 and asked the following question:

@cristianadam
cristianadam / cmake generator expression refactoring.md
Last active August 6, 2025 16:09
Devstrall Small 2505 CMake knowledge

On a MacBook Pro with Apple Silicon I have done the following:

% brew install llama.cpp
% llama-server -hf unsloth/Devstral-Small-2505-GGUF:UD-Q4_K_XL --jinja 

I have used here the default context value -c 4096. Devstral can do 128K but I ran out of memory on this MacBook Pro M3 with 36GB, that is when using -c 0.

Then opened a webbrowser at localhost:8080 and asked the following question:

@cristianadam
cristianadam / CMakeLists.txt
Created February 9, 2025 18:38
CMake using add_custom_target and add_dependencies
cmake_minimum_required(VERSION 3.20)
project(deps)
file(WRITE ${CMAKE_BINARY_DIR}/library.cpp "
#include <fstream>
#include <string>
std::string message()
{
@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)