This is a quick proof of concept of using the LLVM JIT compiler as
Python's extension module loader. This implelentation completely
replaces the standard extension module framework, so regular extension
modules cannot be loaded. It would not be too difficult to extend the
patch to allow loading both LLVM bitcode (.bc) and regular extension
(.so) modules.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| *.py[oc] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <boost/python.hpp> | |
| #include <iostream> | |
| namespace { | |
| void *convert_to_FILEptr(PyObject* obj) { | |
| return PyFile_Check(obj) ? PyFile_AsFile(obj) : 0; | |
| } | |
| } | |
| void test_argument(FILE* f) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # VNC Server (Virtual-Mode) start-up script. | |
| unset XDG_RUNTIME_DIR | |
| [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources | |
| xsetroot -solid grey | |
| if [ -f /usr/bin/gnome-session ]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| A SAT-based KenKen (http://www.kenken.com/) solver. | |
| The implementation of this solver is based on the ideas contained in | |
| the paper: | |
| "A SAT-based Sudoku solver" by Tjark Weber | |
| https://www.lri.fr/~conchon/mpri/weber.pdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| An Python re-implementation of hierarchical module import. | |
| Function names and arguments have been chosen to mimic the C code in | |
| `Python/import.c` whenever possible. | |
| This code is intended to be read, not executed. However, it does work | |
| -- all you need to do to enable it is "import knee". | |
| (The name is a pun on the klunkier predecessor of this module, "ni".) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| // Emulate the for-else Python construct in C++. | |
| // http://docs.python.org/2/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops | |
| int main() { | |
| for (int n = 2; n < 10; n++) { | |
| bool success = true; | |
| for (int x = 2; x < n || (success = false); x++) { | |
| if (n % x == 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| """Calculate the minimal bounding box of a series of images. | |
| Example usage:: | |
| $ find_bounding_box.py *.jpg | |
| 836x680+64+0 | |
| $ mogrify -crop 836x680+64+0 *.jpg | |
| Requires the `identify` command which is part of ImageMagick. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| """ | |
| Change the screen resolution and restart Nautilus. | |
| You may need to provide your VNC server with a list of available | |
| resolutions. See: | |
| http://stackoverflow.com/questions/15816/changing-the-resolution-of-a-vnc-session-in-linux | |
| """ | |
| #----------------------------------------------------------------------------- |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
NewerOlder