Skip to content

Instantly share code, notes, and snippets.

@heidaga
heidaga / Swig misc
Last active September 12, 2016 13:38
%module(docstring="A Python interface to the C++ library CIMUTIL") cimutilpy
%{
/* Includes the header in the wrapper code */
#include "Attribute.h"
#include "AttributeOperations.h"
#include "AttributesManager.h"
#include "CIMArray.h"
#include "CIMBase.h"

Small guideline to build python qt application with pyqt4 (ui ressources from QtDesigner (qrc file)) and Py2exe

steps

  • add an empty file init.py in the dir C:\Python27\Lib\site-packages\mpl_toolkits

  • remove from scipy.stats import gaussian_kde

  • In C:\Python27\Lib\site-packages\PyQt4\uic , rename/delete port_v3 so that itll be ignored by py2exe. This solves the following error:

#!/usr/bin/env python
"""
Pandoc filter to process code blocks with class `plantuml` into
plantuml-generated images with support of embedded URL links using `object` tag instead of `img` tag
Backward compatibility is maintained for the `img` tag, in this case use the class `plantuml_old`
Based on the examples in the repo of pandocfilters by jgm
"""
import hashlib
import os
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta name="generator" content="pandoc" />
<title></title>
<style type="text/css">code{white-space: pre;}</style>
</head>
<body>
@heidaga
heidaga / pandoc-plantuml.py
Last active April 15, 2016 12:58
Pandoc python filter to create PNG image files by parsing PlantUML code. It can be used also with graphviz.py from pandocfilters. Keywords: pandoc plantuml python
#!/usr/bin/env python
"""
Pandoc filter to process code blocks with class "uml" into
plantuml-generated images.
"""
import hashlib
import os
import sys
#include <vector>
#include <utility>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
vector<pair<int, int> > result;
#include <stdio.h>
#include <iostream>
#include <vector>
using namespace std;
void getPermutations(int index, vector<int> output, vector< vector<int> > &solutions, vector<int> boxes)
{
if (index == output.size())
{
solutions.push_back(output);