#Install blender as a module with python 3.5 and pyenv
Tested on Ubuntu 14.04.
Follow instructions from here.
Follow instructions from here.
| // https://stackoverflow.com/questions/10750057/how-to-print-out-the-contents-of-a-vector/11335634#11335634 | |
| #include <iostream> | |
| #include <algorithm> // for copy | |
| #include <iterator> // for ostream_iterator | |
| #include <vector> | |
| int main() { | |
| /* Set up vector to hold chars a-z */ | |
| std::vector<char> path; |
| import ctypes | |
| import mmap | |
| import os | |
| import stat | |
| import sys | |
| try: | |
| unicode | |
| except NameError: |
| Run: | |
| uname -r | |
| Note this: | |
| *default*/*desktop*/*pae* | |
| Add repo: | |
| zypper ar -f -n packman http://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Tumbleweed/pacman.repo | |
| for default: |
| #!/bin/bash | |
| function echo_mem_stat () { | |
| mem_total="$(free | grep 'Mem:' | awk '{print $2}')" | |
| free_mem="$(free | grep 'Mem:' | awk '{print $7}')" | |
| mem_percentage=$(($free_mem * 100 / $mem_total)) | |
| swap_total="$(free | grep 'Swap:' | awk '{print $2}')" | |
| used_swap="$(free | grep 'Swap:' | awk '{print $3}')" | |
| swap_percentage=$(($used_swap * 100 / $swap_total)) |
| # ##### BEGIN GPL LICENSE BLOCK ##### | |
| # | |
| # This program is free software; you can redistribute it and/or | |
| # modify it under the terms of the GNU General Public License | |
| # as published by the Free Software Foundation; either version 2 | |
| # of the License, or (at your option) any later version. | |
| # | |
| # This program is distributed in the hope that it will be useful, | |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
The goal of this example is to show how an existing C codebase for numerical computing (here c_code.c) can be wrapped in Cython to be exposed in Python.
The meat of the example is that the data is allocated in C, but exposed in Python without a copy using the PyArray_SimpleNewFromData numpy