Skip to content

Instantly share code, notes, and snippets.

View peci1's full-sized avatar

Martin Pecka peci1

  • Czech Technical University in Prague
  • Czech republic
View GitHub Profile
@peci1
peci1 / dynamic_reconfigure_tools.py
Created November 5, 2015 01:55
ROS dynamic_reconfigure enum with variable value set.
def change_enum_items(type, parameter_name, new_items, default=None):
"""
Take an enum-typed parameter in the given autogenerated cfg type and reset its possible values to new_items.
You can then start a dynamic_reconfigure server which advertises the changed enum domain.
To achieve this, you need to call this function before creating the server.
:param type type: One of the autogenerated config types (package.cfg.*Config).
:param basestring parameter_name: Name of the enum parameter to change.
:param new_items: The items that will form the new domain of the enum.
@peci1
peci1 / .htaccess
Created May 22, 2014 21:02
Silly (but powerful) .htaccess handling of script-generated web thumbnails
#############################
# START: THUMBNAIL HANDLING #
#############################
# Since handling thumbnails in Nette is painfully slow (loading the whole framework
# just to find out that the thumbnail has already existed), there is a workaround
# that finds all the generated thumbnails using mod_rewrite and only redirects to the
# script if generating a thumbnail is really needed.
# Even for generating thumbs the standard Nette usage is slow, so there is another workaround.