Skip to content

Instantly share code, notes, and snippets.

FROM quay.io/pypa/manylinux2014_aarch64:2022-07-25-160c2d8
WORKDIR /root
ADD repro.cmake repro.cmake
RUN yum update && yum install -y openssl-devel
# currently at `5fc4e121a18d9e403f1541348c2889e9bc153791`
RUN git clone --depth=1 https://github.com/Kitware/CMake && \
mkdir -p CMake/build && \
@ihnorton
ihnorton / CMakeLists.txt
Last active June 4, 2021 02:53
vcpkg simple bootstrap test
cmake_minimum_required(VERSION 3.14)
set(CMAKE_CXX_STANDARD 17)
include(FetchContent)
FetchContent_Declare(
vcpkg
GIT_REPOSITORY https://github.com/microsoft/vcpkg.git
GIT_TAG 2021.05.12
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ihnorton
ihnorton / ex.cc
Last active May 8, 2020 15:46
how to get data pointer from pybind11::array_t
# for example, in debugger
# given `o` that we know is a `pybind11::array_t` of some specialization:
((uint64_t*)pybind11::detail::array_proxy(o.m_ptr)->data)[idx]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ihnorton
ihnorton / CMakeLists.txt
Last active April 21, 2020 01:54
Debugging code
project(foo)
cmake_minimum_required(VERSION 3.12)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_BUILD_TYPE Debug)
###
set(SRCS test_incomplete test_main)
###
set(TileDB_DIR "${TileDB_DIST}/lib64/cmake/TileDB")
@ihnorton
ihnorton / this.txt.py
Created December 20, 2019 16:23
adding prepended linker arguments with distutils
# in distutils/command/build_ext.py
# obviously a one-off hack...
549 self.compiler.link_shared_object(
550 objects, ext_path,
551 libraries=self.get_libraries(ext),
552 library_dirs=ext.library_dirs,
553 runtime_library_dirs=ext.runtime_library_dirs,
554 extra_preargs=['-Wl,-Bsymbolic-functions', '-Wl,-Bsymbolic'],
555 extra_postargs=extra_args,
@ihnorton
ihnorton / application.py
Last active December 20, 2019 15:39
demo-flask-app-with-fix
from flask import Flask
# from https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-flask.html#python-flask-create-app
libp=b"/opt/python/run/venv/lib64/python3.6/site-packages/tiledb/libtiledb.cpython-36m-x86_64-linux-gnu.so"
import os, ctypes, sys
ctypes.CDLL(libp, os.RTLD_DEEPBIND)
import tiledb
# print a nice greeting.
@ihnorton
ihnorton / flask-segfault-gdb-debug.md
Last active December 20, 2019 14:40
debugging a flask/elastic beanstalk app with gdb

debugging a flask app on elastic beanstalk with gdb

this gist contains several iterations of attempting to attach gdb to a flask/wsgi app running on elastic beanstalk. assumption: ssh access (requires setting a key in the config, and then get the IP address from EB console or EC2 instance list), and sudo.

tl;dr: simple working solution is to

  • write out the pid in /tmp/xpid
  • sleep in a while loop and wait until that file disappears to continue
@ihnorton
ihnorton / bouncywin.swift
Last active December 9, 2019 20:51
Bouncy window manager "solution" (screen capture at bottom)
import Cocoa
import Foundation
import AppKit
import CoreFoundation
import ApplicationServices
/// https://jvns.ca/blog/2019/11/25/challenge--make-a-bouncy-window-manager/
/*
This code runs the following sequence: