Skip to content

Instantly share code, notes, and snippets.

View adrienkaiser's full-sized avatar

Adrien Kaiser adrienkaiser

View GitHub Profile
@adrienkaiser
adrienkaiser / Slicer CLI: check xml description Qt
Last active December 12, 2015 07:59
This little program allows to see if the xml description of the Slicer CLI module is read correctly by readAllStandardOutput() from QProcess.It has been developped to debug the failing load of some of our CLI modules with the message "Failed to retrieve Xml Description" for the extension "DTIPrep".See http://github.com/Slicer/Slicer/blob/master/…
(added for title)
@adrienkaiser
adrienkaiser / create_EXR_channels_from_LDR_image
Last active December 29, 2015 08:19
Code to compute HDR image from a set of LDR images.
int create_EXR_channels_from_LDR_image(IplImage **images, const float *Te, int nimg, float gfunction[256], const int width, const int height, float* EXRDataPtr)
{
cvNamedWindow("images LDR", 0); // Tester : supprimer ceci
clock_t deb,fin,diff;
deb=clock();
CvScalar Z;
CvSize size=cvGetSize(images[0]);
float numerateur[3]={0.0,0.0,0.0},denominateur[3]={0.0,0.0,0.0};
float *dataf = EXRDataPtr;
float *Mdataf;
@adrienkaiser
adrienkaiser / fill_color_from_weight
Last active December 30, 2015 05:49
Function to color vertices from an interpolation of its bones
void mesh::fill_color_from_weight(int nbBones)
{
srand(42);
std::vector<vec3> boneColor;
for(unsigned int b=0; b<nbBones; b++)
{
// float iBone = (float)b/(float)nbBones;
boneColor.push_back(vec3(float(rand())/RAND_MAX,float(rand())/RAND_MAX,float(rand())/RAND_MAX));
}
@adrienkaiser
adrienkaiser / readMapXML.py
Created March 18, 2014 15:42
A small python script to retrieve specific data from a XML file given as argument, and write it out to be used in C++ code.
#!/usr/bin/python
# Usage:
# $ readMapXML.py map.xml > mapcpp.txt
import sys # For argv and exit
if len(sys.argv) < 2:
sys.exit(1)
http://stackoverflow.com/questions/9751845/apt-get-for-cygwin
https://github.com/transcode-open/apt-cyg
$ wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg
$ install apt-cyg /bin
$ apt-cyg install [package]
## Install packages for python on windows :
https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py
# Mount shared folder from windows to U
# http://helpdeskgeek.com/virtualization/virtualbox-share-folder-host-guest/
$ mount -t vboxsf VBoxShare ~/VBoxShare
$ sudo apt-get install virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11
Start CYGWIN
## Connect to AWS server from Cygwin
[CYGWIN] $ ssh -i ~/WinHome/Work/AE/Corexpert/cxp_frankfurt_dmaas.pem [email protected]
## Setup web server on AWS EC2 server
# https://www.digitalocean.com/community/tutorials/how-to-configure-the-apache-web-server-on-an-ubuntu-or-debian-vps
$ sudo aptitude update
$ sudo aptitude upgrade
@adrienkaiser
adrienkaiser / Run Mediation - Python
Last active August 29, 2015 14:11
Run mediation pipeline with python from command line
Start CYGWIN
## Connect to AWS server from Cygwin
$ ssh -i ~/WinHome/Work/AE/Corexpert/cxp_frankfurt_dmaas.pem [email protected]
## Install python dependencies
$ sudo aptitude install python-gevent
$ sudo aptitude install python-rdflib
$ sudo aptitude install python-simplejson
@adrienkaiser
adrienkaiser / pelican
Last active August 29, 2015 14:18
Pelican website
http://blog.john-pfeiffer.com/how-to-set-up-a-pelican-static-blog-site/
http://docs.getpelican.com/
pip install pelican markdown
mkdir -p ~/projects/yoursite
cd ~/projects/yoursite
@adrienkaiser
adrienkaiser / create_nurbs_camera_path.py
Created July 15, 2019 10:03
Blender script to generate a NURBS curve from a camera's path.
import bpy
from mathutils import Vector
# Create the curve data
# https://blender.stackexchange.com/a/6751
curveData = bpy.data.curves.new('CameraCurve', type='CURVE')
curveData.dimensions = '3D'
curveData.resolution_u = 2
curveData.bevel_depth = 0.01 # curve radius in meters
polyline = curveData.splines.new('NURBS')