Skip to content

Instantly share code, notes, and snippets.

View svarnypetr's full-sized avatar
🇨🇿

Petr Svarny svarnypetr

🇨🇿
View GitHub Profile
@svarnypetr
svarnypetr / bulkExtract.sh
Created May 25, 2019 06:09
ROS experiments bulk data extractor
#!/bin/bash
:'
If you have multiple rosbags each in its own folder and need to extract some experimental data from them.
The gist shows how to run processing scripts that are part of a ROS package and also export some ROS topics.
A workspace needs to be sourced before this script is ran!
'
ROS_PACKAGE=your_ros_package
roscore &
@svarnypetr
svarnypetr / iros_renamer.py
Last active October 22, 2018 11:01
IROS 2018 document renamer
from os import listdir, rename, makedirs
from os.path import isfile, isdir, join
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
files_path = r'media/files/'
pdf_list = [f for f in listdir(files_path) if (isfile(join(files_path, f)) and '.pdf' in f)]
video_list = [f for f in listdir(files_path) if (isfile(join(files_path, f)) and '.VI.mp4' in f)]
converted_dir_name = 'converted'
converted_dir_path = converted_dir_name + '/'
@svarnypetr
svarnypetr / get_siblings
Created February 14, 2017 13:24
How to get siblings in a Networkx.DiGraph
def get_siblings(aGraph, aNode):
"""
Get siblings of aNode in aGraph.
:param: aNode: {str}
:param: aGraph: {networkx.DiGraph}
:return: {list}
"""
try:
parentEdge = [(u,v,d) for u,v,d in aGraph.edges(data=True)
if v == aNode ]
@svarnypetr
svarnypetr / README.MD
Created September 22, 2016 13:20 — forked from aanastasiou/README.MD
Generate a Cypher query to store a Python Networkx directed graph

Exporting a Networkx graph as a Cypher query

This little project defines a function that can be used to construct a Cypher query which when executed against a Neo4j database server will store the graph to the server.

Background

  • A Graph is an abstract mathematical model composed of Nodes connected through Edges that can be used to describe complex systems composed of a set of parts (corresponding to nodes) and their connections (corresponding to edges).
  • Examples of graphs are road networks (junctions connected via roads), electronic circuit networks (components and their connections) and others
  • Networkx is an excellent Python module for manipulating such Graph objects of any kind.
  • Neo4j is a graph database. It uses the Graph as a data model to store such objects to a data store.