Skip to content

Instantly share code, notes, and snippets.

View awesomebytes's full-sized avatar

Sam Pfeiffer awesomebytes

View GitHub Profile
@awesomebytes
awesomebytes / code_connect_via_command_line.md
Last active June 28, 2025 20:33
How to open Visual Studio Code via command line (local file, remote-ssh, docker, remote-docker)

How to open Visual Studio Code via command line

In order to open a Visual Studio Code sometimes we want to do it from the command line. Either because that allows us to just open the current file or folder, or because we would like to script opening some specific resource. This resource may be placed in another machine (e.g. via ssh), or in a docker container (running in the same machine or in another machine).

Local file or folder

code <file or folder>
# e.g. code .
@awesomebytes
awesomebytes / ipython_to_file.md
Created March 16, 2016 10:38
Save iPython session to a python file as code

Save an iPython session commands/code to a file

You must use the magic method %save:

In [1]: %save?
Type:       Magic function
String Form:<bound method CodeMagics.save of <IPython.core.magics.code.CodeMagics object at 0x7fb5d25bb1d0>>
Namespace:  IPython internal
File: /usr/lib/python2.7/dist-packages/IPython/core/magics/code.py
@awesomebytes
awesomebytes / Fix_InvalidResourceName_Double_Slash_Softlink.md
Created May 15, 2025 10:20
Fix rosidl_adapter.parser.InvalidResourceName: // error due to softlinks in the ROS2 package
@awesomebytes
awesomebytes / simple_debian_repository.md
Last active April 8, 2025 17:25
How to create a simple debian repository with minimal dependences

Simple debian repository

How to have a simple debian repository to offer your packages.

Requirements

You probably have them already installed

  • Python (I used 2.7).
  • dpkg-scanpackages: sudo apt-get install dpkg-dev
  • gzip: sudo apt-get install gzip
@awesomebytes
awesomebytes / debian_from_ros_pkg.md
Last active February 18, 2025 13:59
How to create a debian from a ROS package
@awesomebytes
awesomebytes / reduce_faces.py
Created April 6, 2016 23:23
Executing meshlab from commandline reduce faces of a mesh iteratively
#!/usr/bin/env python
import sys
import os
import subprocess
# Script taken from doing the needed operation
# (Filters > Remeshing, Simplification and Reconstruction >
# Quadric Edge Collapse Decimation, with parameters:
# 0.9 percentage reduction (10%), 0.3 Quality threshold (70%)
@awesomebytes
awesomebytes / Malformed_STL_fix.md
Last active January 13, 2025 13:38
How to fix a malformed stl (says Rviz)

Fix malformed stl (says Rviz)

To correct:

The STL file 'package://wsg_50_simulation/meshes/WSG-FMF.stl' is malformed. It starts with the word 'solid', indicating that it's an ASCII STL file, but it does not contain the word 'endsolid' soit is either a malformed ASCII STL file or it is actually a binary STL file. Trying to interpret it as a binary STL file instead.

When launching Rviz with a URDF containing SolidWorks created meshes in STL.

Just go to the folder with STL's with this problem and do:

@awesomebytes
awesomebytes / python_development_environment.md
Last active December 25, 2024 11:34
My development environment, how to install it

Python development environment (with ROS!)

Install pip

The package manager of python packages is called pip.

sudo apt-get install python-pip

If you need a pip package as a debian you can use Victor's debian from pip.

Install ipython

@awesomebytes
awesomebytes / box.scene
Created April 26, 2016 10:16
MoveIt! scene file example, remove the commented one to load it (it does not support comments)
box_scene
* box1
1
box
0.1 0.2 0.3
1.0 1.0 1.0
0 0 0 1
0 1 0 1
.
@awesomebytes
awesomebytes / image_tools.py
Created November 12, 2018 05:49
ImageTools is a class to deal with conversions from & to ROS Image, ROS CompressedImage and numpy.ndarray (cv2 image).
#!/usr/bin/env python
import numpy as np
import cv2
from cv_bridge import CvBridge, CvBridgeError
"""
ROS ImageTools, a class that contains methods to transform
from & to ROS Image, ROS CompressedImage & numpy.ndarray (cv2 image).
Also deals with Depth images, with a tricky catch, as they are compressed in
PNG, and we are here hardcoding to compression level 3 and the default