Skip to content

Instantly share code, notes, and snippets.

View roliveira's full-sized avatar
👋

Rodolfo Oliveira roliveira

👋
View GitHub Profile
# From: http://wiki.blender.org/index.php/Doc:2.6/Manual/Extensions/Python/Geometry
import bpy
# Define the coordinates of the vertices. Each vertex is defined by a tuple of 3 floats.
coords=[(-1.0, -1.0, -1.0), (1.0, -1.0, -1.0), (1.0, 1.0 ,-1.0), \
(-1.0, 1.0,-1.0), (0.0, 0.0, 1.0)]
# Define the faces by index numbers of its vertices. Each face is defined by a tuple
# of 3 or more integers. N-gons would require a tuple of size N.
faces=[ (2,1,0,3), (0,1,4), (1,2,4), (2,3,4), (3,0,4)]
@roliveira
roliveira / blender_delete_cube.py
Created March 29, 2015 11:49
Get rid of the `default` Cube present in Blender
import bpy
if "Cube" in bpy.data.objects.keys():
bpy.data.objects.get("Cube").select = True
bpy.ops.object.delete()
@roliveira
roliveira / scikit_plot_marching_cubes.py
Last active August 29, 2015 14:17
Plot a surface created using marching cubes of two identical ellipsoids (http://scikit-image.org/docs/dev/auto_examples/plot_marching_cubes.html)
"""
==============
Marching Cubes
==============
Marching cubes is an algorithm to extract a 2D surface mesh from a 3D volume.
This can be conceptualized as a 3D generalization of isolines on topographical
or weather maps. It works by iterating across the volume, looking for regions
which cross the level of interest. If such regions are found, triangulations
are generated and added to an output mesh. The final result is a set of
@roliveira
roliveira / collate.py
Last active October 8, 2020 20:41
Crop, split and collate PDFs using pyPdf
import argparse
from pyPdf import PdfFileWriter, PdfFileReader
def create_parsers():
p = argparse.ArgumentParser(
prog='crop',
description='"%(prog)s" crop pdfs',
@roliveira
roliveira / .latexmkrc
Last active September 29, 2018 08:42
my latexmk configuration
$pdflatex='pdflatex -interaction=nonstopmode';
$pdf_previewer = "start zathura";
$pdf_update_method=0;
$pdf_mode = 1;
$dvi_mode = 0;
$preview_continuous_mode = 1;
add_cus_dep('glo', 'gls', 0, 'run_makeglossaries');