Skip to content

Instantly share code, notes, and snippets.

@adrianherrera
adrianherrera / gen-clang-ast.py
Last active February 8, 2024 09:44
Generate a Clang AST in JSON format
#!/usr/bin/env python3
"""
Generate a Clang AST (in JSON format) from a compilation database. Adapted from
run-clang-format.py.
I use [bear](https://github.com/rizsotto/Bear) to generate the compilation
database.
Author: Adrian Herrera
@gatchamix
gatchamix / is_constexpr.cpp
Last active August 27, 2021 06:25
is_constexpr macro to determine whether a given expression can be assigned to a constexpr variable or not
#include <utility>
#include <string>
#include <string_view>
using namespace std::literals;
//
template <class F, class... Args,
class = decltype(std::declval<F&&>()(std::declval<Args&&>()...))>
@bellbind
bellbind / cpuinfo.c
Created October 29, 2015 07:07
[c][intel][clang] get cpu info from CPUID intrinsic in clang/gcc
// intel CPUID opcode
// see: https://en.wikipedia.org/wiki/CPUID
// clang -Wall -Wextra -std=c11 cpuinfo.c -o cpuinfo
#include <stdint.h>
#include <stdio.h>
#include <cpuid.h> //macro __cpuid(eaxin, eaxout, ebx, ecx, edx)
int main() {
{
@jpflouret
jpflouret / README.md
Last active December 29, 2023 03:33
paste.exe

Pipe contents of windows clipboard to another command

Usage

To pipe the contents of the clipboard to another command (e.g. grep):

paste | grep pattern

To save the contents of the clipboard to a file: