Skip to content

Instantly share code, notes, and snippets.

View diegoferigo's full-sized avatar
🤖
Code, rinse, repeat.

Diego Ferigo diegoferigo

🤖
Code, rinse, repeat.
View GitHub Profile
@diegoferigo
diegoferigo / convert_mesh.py
Last active August 8, 2023 15:42
Mesh conversion with trimesh
import argparse
import pathlib
import trimesh.exchange.export
if __name__ == "__main__":
"""Mesh conversion script."""
parser = argparse.ArgumentParser(
description="Convert a mesh file between different formats.",
@diegoferigo
diegoferigo / README.md
Last active April 2, 2023 15:14
JAX for scientific programming: an introduction

JAX for scientific programming: an introduction

Binder

@diegoferigo
diegoferigo / embed_bib_in_tex.md
Created February 16, 2020 11:10
Embed the BIB file in the main TEX manuscript

When submitting a paper, often publishers do not support including external bibliography files. Bibliography must be converted and included in the manuscript file before the submission.

The following works if you use bibtex to generate the bibliography. Somehow it could be done also with biblatex, but it is more complicated.

  1. Let's assume the references are stored in a references.bib file
  2. Compile your latex project and get the final version of your pdf manuscript, with all the references included
  3. Comment out the \bibliography{references} line that imports the external .bib file
  4. Copy the content of the autogenerated references.bbl file right below the commented \bibliography comment
  5. To be sure that everything works, remove the temp references.aux file
  6. Recompile your latex project and inspect the output pdf file
@diegoferigo
diegoferigo / export_tikz_to_pdf.md
Last active August 15, 2022 12:29
Export TIKZ figures of a manuscript to PDF

When submitting a paper, often publishers do not support manuscripts with TIKZ figures. These figures must be converted and substituted before the submission.

In order to preserve the quality and not lose the vector format, either EPS or PDF types are good candidates. Since most of the times we use pdflatex to build manuscripts, we'll use PDF. If you need an EPS, PDF files can be converted.

  1. Add in the preamble of your manuscript the following:
    \usetikzlibrary{external}
    \tikzexternalize
  2. Compile your manuscript with: pdflatex -shell-escape ms.tex
@diegoferigo
diegoferigo / WBT4_to_WBT5.sh
Last active January 31, 2019 13:35
Port a Simulink model from Whole-Body Toolbox v4 to v5
#!/bin/bash
set -e
set -u
Color_Off='\e[0m'
BRed='\e[1;31m'
BBlue='\e[1;34m'
BGreen='\e[1;32m'
function msg()
@diegoferigo
diegoferigo / SAP_CLA
Created August 12, 2018 10:02 — forked from CLAassistant/SAP_CLA
SAP Individual Contributor License Agreement
###SAP Individual Contributor License Agreement
Thank you for your interest in contributing to open source software projects (“Projects”) made available by SAP SE or its affiliates (“SAP”). This Individual Contributor License Agreement (“Agreement”) sets out the terms governing any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that you submit or have submitted, in any form and in any manner, to SAP in respect of any of the Projects (collectively “Contributions”). If you have any questions respecting this Agreement, please contact opensource@sap.com.
You agree that the following terms apply to all of your past, present and future Contributions. Except for the licenses granted in this Agreement, you retain all of your right, title and interest in and to your Contributions.
**Copyright License.** You hereby grant, and agree to grant, to SAP a non-exclusive, perpetual, irrevocable, worldwid
@diegoferigo
diegoferigo / Plot2LaTeX.m
Last active April 30, 2020 07:46
Plot2Latex for Linux
function Plot2LaTeX( h, filename, options )
%PLOT2LATEX saves matlab figure as a pdf file in vector format for
%inclusion into LaTeX. Requires free and open-source vector graphics
%editor Inkscape.
%
% PLOT2LATEX(h,filename) saves figure with handle h to a file specified by
% filename, without extention. Filename can contain a relative location
% (e.g. 'images\title') to save the figure to different location.
%
% PLOT2LATEX(h,filename, options) saves figure with specified options.
@diegoferigo
diegoferigo / README.md
Last active April 26, 2018 13:18
Setup the Workstation: cyberith + oculus

Tools

Chocolatey

Install Chocolatey to handle dependencies. Then:

choco install cmake --installargs 'ADD_CMAKE_TO_PATH=User'
choco install git
choco install ninja # This is required by opencv installed via vcpkg

I'm setting up these files for discussing a common clang-format that will be used across our projects. As far as I understood, using WebKit as base finds many of us happy. The first release has been generated by

clang-format --style=webkit -dump-config

A good starting point for the available options is Clang-Format Style Options.

Here below you can find some code that covers many cases, I'll keep this updated with the style agreed so far. I didn't find any demo code that already covers most of the C++ standard (any suggestion?). When discussing something, if it is not clear from the code below, please provide a code snippet to show your point. I'll include your example afterwards.

Demo Code

@diegoferigo
diegoferigo / .bashr_loc2.sh
Last active November 30, 2018 10:42
How-To YARP + iCub: random notes
# Disable echo ^C when Ctrl+C is pressed
stty -echoctl
# Export variables
export EDITOR="nano" # Set the default editor
shopt -s autocd # Avoid using cd to change directory. Simply: ~# /etc
shopt -s cdspell # Basilar typos autocorrect
shopt -s dirspell # Dir names spelling correction
shopt -s cmdhist # Inline multiline commands