Skip to content

Instantly share code, notes, and snippets.

View christianparpart's full-sized avatar
🎃
Loading

Christian Parpart christianparpart

🎃
Loading
View GitHub Profile
@christianparpart
christianparpart / detect-color-mode.cpp
Created October 3, 2024 10:15
Detect OS dark/light color mode setting from within the terminal
// SPDX-License-Identifier: Apache-2.0
// Implements https://contour-terminal.org/vt-extensions/color-palette-update-notifications/
#include <cstdlib>
#include <iostream>
#include <string_view>
#include <termios.h>
#include <unistd.h>
@christianparpart
christianparpart / clang-error.txt
Created February 1, 2023 19:20
I'm not giving up on compiler oopses :)
0. Program arguments: /home/christianparpart/usr/opt/clang+llvm-15.0.2-aarch64-linux-gnu/bin/clang++ -Og -g -fdiagnostics-color=always -Qunused-arguments -Wall -Wduplicate-enum -Wextra -Wextra-semi -Wfinal-dtor-non-final-class -Wimplicit-fallthrough -Wmissing-declarations -Wnewline-eof -Wno-unknown-attributes -Wno-unknown-pragmas -Wnull-dereference -Wpessimizing-move -Wredundant-move -Wsuggest-destructor-override -pedantic -Wno-error=c++20-extensions -Wno-c++20-extensions -Wno-error=missing-declarations -Wno-missing-declarations -march=armv8-a+fp+simd+crypto+crc -std=c++20 -Werror -DBOOST_STACKTRACE_USE_ADDR2LINE=1 -DCONTOUR_STACKTRACE_ADDR2LINE=1 -DFMT_HEADER_ONLY=1 -DHAVE_BACKTRACE -DHAVE_BACKTRACE_SYMBOLS -DHAVE_CXXABI_H -DHAVE_DLADDR -DHAVE_DLFCN_H -DHAVE_DLSYM -DHAVE_EXECINFO_H -DHAVE_SYS_SELECT_H -DHAVE_UNWIND_H -DLIBTERMINAL_LOG_TRACE=1 -DLIBTERMINAL_NAME=\"contour\" -DLIBTERMINAL_VERSION_MAJOR=0 -DLIBTERMINAL_VERSION_MINOR=3 -DLIBTERMINAL_VERSION_PATCH=11 -DLIBTERMINAL_VERSION_STRING=\"0.3.11-cla
@christianparpart
christianparpart / vt-spec-passive-mouse-tracking.md
Last active January 21, 2024 20:24
Terminal Spec: Passive Mouse Tracking

Passive Mouse Tracking

Motivation

While mouse event tracking is already possible in various modes and encodings, this feature seems most used by alt-screen applications however.

The reason why primary screen applications (such as your shell) usually don't make use of the mouse, is the design problem, that whenever the application is requesting mouse tracking events, the user cannot use the mouse to select text on the screen anymore.

With this VT extension, a new mode is introduced to inform the terminal that the user may still use the mouse to select text, but still have mouse events being reported to the application to allow passive tracking of mouse events.

@christianparpart
christianparpart / progress-bar-demo.cpp
Created May 2, 2022 08:08
C++ Progress bar, using new Fira Code inspired codepoints.
#include <array>
#include <chrono>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string_view>
#include <thread>
using namespace std;
using namespace std::chrono;
soltest.exe!solidity::yul::StructuralSimplifier::simplify(std::vector<std::variant<solidity::yul::ExpressionStatement,solidity::yul::Assignment,solidity::yul::VariableDeclaration,solidity::yul::FunctionDefinition,solidity::yul::If,solidity::yul::Switch,solidity::yul::ForLoop,solidity::yul::Break,solidity::yul::Continue,solidity::yul::Leave,solidity::yul::Block>,std::allocator<std::variant<solidity::yul::ExpressionStatement,solidity::yul::Assignment,solidity::yul::VariableDeclaration,solidity::yul::FunctionDefinition,solidity::yul::If,solidity::yul::Switch,solidity::yul::ForLoop,solidity::yul::Break,solidity::yul::Continue,solidity::yul::Leave,solidity::yul::Block>>> & _statements) Line 129
at C:\source\ethereum\solidity\libyul\optimiser\StructuralSimplifier.cpp(129)
soltest.exe!solidity::yul::StructuralSimplifier::operator()(solidity::yul::Block & _block) Line 92
at C:\source\ethereum\solidity\libyul\optimiser\StructuralSimplifier.cpp(92)
soltest.exe!solidity::yul::ASTModifier::operator()(solidity::yul::If
@christianparpart
christianparpart / solidity-launch.json
Created April 6, 2022 09:14
VScode launch.json for Solidity
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "solc",
"type": "cppdbg",
"request": "launch",
@christianparpart
christianparpart / solidity-settings.json
Created April 6, 2022 09:12
VScode settings.json for Solidity
{
"search.exclude": {
"**/build": true,
"**/release": true,
"**/out": true
},
"cmake.generator": "Ninja",
"cmake.parallelJobs": 24,
"cmake.configureSettings": {
"VCPKG_TARGET_TRIPLET": "x64-windows",
release:
version: 0.2.3
platforms:
"Windows":
sha: ABCDEF...
"Ubuntu 18.04":
sha: ...
"Ubuntu 20.04":
sha: ...
@christianparpart
christianparpart / solc-lsp-tcp-listener.patch
Created November 29, 2021 11:48
Patch for reviving LSP TCP listener.
commit 6cccca59014f49c52faaf19f8f2e9f102f519884
Author: Christian Parpart <christian@parpart.family>
Date: Mon Nov 29 12:46:52 2021 +0100
Revert "Drop LSP TCP listener."
This reverts commit 5b61209d11fe046dfc57e4c74762c3da9dfc0e3d.
diff --git a/solc/CMakeLists.txt b/solc/CMakeLists.txt
index 3e3594766..51b77d29b 100644
#include <array>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <limits>
#include <string_view>
#include <tuple>
#include <utility>
#include <immintrin.h>