Skip to content

Instantly share code, notes, and snippets.

@sterin
sterin / sort_pis_by_name.py
Created November 10, 2023 14:47
Sort AIG PIs by name
# This script requires pyaig and click, they can be installed by running:
# > pip install pyaig click
# run the script as follows:
# > python sort_pis_by_name.py input.aig output.aig
# output.aig would the same as input.aig, except that the inputs would be sorted by name
# the script assumes all PIs have names
import click
from pyaig import *
@sterin
sterin / opengl-ubuntu-ec2-install.md
Created September 14, 2017 00:10 — forked from dgoguerra/opengl-ubuntu-ec2-install.md
Set up OpenGL on a Ubuntu 16.04 g2.2xlarge EC2 machine (following https://stackoverflow.com/q/19856192)

Steps from https://stackoverflow.com/q/19856192 with minor changes to work on Ubuntu 16.04.

# Install the Nvidia driver
sudo apt-add-repository ppa:ubuntu-x-swat/updates
sudo apt-get update
sudo apt-get install nvidia-current

# Driver installation needs reboot
sudo reboot now
cmake_minimum_required(VERSION 3.8)
project(dummy)
find_package(PythonLibs 3 REQUIRED)
find_package(PythonInterp ${PYTHONLIBS_VERSION_STRING} REQUIRED)
find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})
cmake_minimum_required(VERSION 3.0.0)
project(so_example)
# needed to link with Python
find_package(PythonLibs REQUIRED)
# a simple shared library
add_library(shared SHARED shared.cpp)
cmake_minimum_required(VERSION 2.8.4)
project(so_31581722)
find_package(PythonLibs REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})
set(SOURCE_FILES main.cpp)
cmake_minimum_required(VERSION 2.8.4)
project(so29595222)
find_package(PythonLibs REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})
ADD_DEFINITIONS( -std=c++11 )
set(SOURCE_FILES python_threading_example_so29595222.cpp)
@sterin
sterin / CMakeLists.txt
Last active November 7, 2022 12:28
An example showing how to use sub interpreters and threads in Python
cmake_minimum_required(VERSION 2.8.4)
project(py1)
find_package(PythonLibs REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})
ADD_DEFINITIONS( -std=c++11 )
set(SOURCE_FILES main.cpp)