Skip to content

Instantly share code, notes, and snippets.

View heuristicus's full-sized avatar

Michal Staniaszek heuristicus

  • Oxford Robotics Institute
  • Oxford
View GitHub Profile
@heuristicus
heuristicus / conserver.txt
Created August 13, 2011 20:15
Idea for a little project that could be vaguely useful.
Program that takes n folders/files and m devices with storage capacity and decides the best way to distribute files among them to best fill the given devices.
How best to fill devices is debatable, but let's assume that you want to use as much space on each device as possible.
Program would try and keep folders together - option to ignore folder structure and maximise the amount of fill?
Could move each stack into a separate folder to indicate the device it should go on to, if the user does not/cannot plug in all devices.
Method:
@heuristicus
heuristicus / desitter.txt
Created August 24, 2011 14:27
De sitter sim
A de Sitter universe is one where there is no matter or radiation, only a cosmological constant.
create particles which are affected by nothing but each others' gravity, and then let the particles move.
give particles an initial velocity, and then run the system.
Could be a nice little toy which does some quite cool stuff. Also might be a nice exercise in optimisation, since it will probably be crazily inefficient to calculate the mutual gravity of all the particles in the system once you go beyond a relatively small number.
See RRC's comment in http://www.reddit.com/r/askscience/comments/jsmwy/why_do_objects_in_space_orbit_in_the_same_plane/
@heuristicus
heuristicus / stardrawer.txt
Created May 17, 2013 19:32
Little GUI based program in C++ for drawing stars based on some properties
1. Define a set of points which are arranged on a circle
2. Connect points by a line
2.1 Which points are connected is defined by some step value - a value of 4 means that you connect point 0 to point 3, for example
Should be good practice for a little C++ programming, and a nice plaything.
Allow definition of number of points and the step - a slider would be nice to see the patterns made
Make it so that the lines can be drawn in real time if desired - gives an idea of the construction process.
@heuristicus
heuristicus / gist:5879781
Last active December 19, 2015 01:59
Ultimate noughts and crosses
http://mathwithbaddrawings.com/2013/06/16/ultimate-tic-tac-toe/
Implement a thing which labels clusters which have partial information https://en.wikipedia.org/wiki/Transduction_(machine_learning)
@heuristicus
heuristicus / synced_save.cpp
Created September 28, 2018 09:25
Synchronised saver for two image streams coming from ROS, useful for rgb+depth image saving
#include <ros/ros.h>
#include <image_transport/image_transport.h>
#include <image_transport/subscriber_filter.h>
#include <cv_bridge/cv_bridge.h>
#include <opencv2/highgui/highgui.hpp>
#include <boost/format.hpp>
#include <boost/thread.hpp>
#include <boost/filesystem.hpp>
@heuristicus
heuristicus / git_organisation.py
Last active December 2, 2020 10:47
Get details of ori-drs organisation repositories by using the github API
#!/usr/bin/env python
# This script hooks into the github API to make it easy and quick to add repositories and people to teams in
# github organisations.
import sys
import getpass
import argparse
import github
@heuristicus
heuristicus / clang-tidy-git.sh
Created February 3, 2021 15:50
Apply clang-tidy fixes to a codebase and make each fix an individual commit
# This script runs clang-tidy on code to apply its checks for modernisation and readability, applying the fix for each
# check and creating a git commit for it.
# To set up conditions for this file
# 1. Compile your code with the flag -DCMAKE_COMPILE_COMMANDS=ON
# 2. go into the build directory for whatever package you are interested in - it will contain a compile_commands.json file.
# 3. Link compile_commands.json to wherever you have your git repostitory for the code with ln -s
# 4. Run this script in the git repository
# Get the checks we are going to apply to the code, skip the first line which is "enabled checks:" from the clang-tidy output
checks=(`clang-tidy -list-checks -checks="-*,readability*,modernization*" | tail -n +2`)
@heuristicus
heuristicus / get_repo.sh
Last active March 5, 2021 11:54
Try to get a git repository as written, but if the clone fails, check if it's an ssh clone and if so try again with a https clone
# You may prefer to use ssh -A if the reason you need to use this script is because the machine you are cloning on
# doesn't have access to private repositories. This will use ssh credentials from your machine rather than the local ones.
function get_repo() {
# Try to clone the repository as given, but if it fails, check if the url was via ssh, and try to clone
# with https instead. This is useful if you don't have an ssh key with access to private repositories, but do
# have credentials
# Use $@ to make sure we catch stuff like -b branch_name and so on
git clone "$@"
# If the command fails, maybe it's because of ssh. Check if the repo string $1 contains "git@"
@heuristicus
heuristicus / rpy_to_quat.py
Created June 4, 2021 12:05
Converting roll,pitch,yaw to quaternion with transforms3d
#!/usr/bin/env python
import math
import argparse
from transforms3d.euler import euler2quat, quat2euler
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("roll", type=float)
parser.add_argument("pitch", type=float)
parser.add_argument("yaw", type=float)