Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python
import rosbag
import sys
inbag_name = sys.argv[1]
outbag_name = inbag_name.replace('.bag', '-fixed.bag')
with rosbag.Bag(outbag_name, 'w') as outbag:
for topic, msg, t in rosbag.Bag(inbag_name).read_messages():
if topic == "/camera/depth_registered/points_drop" and msg.header.frame_id:
@nivir
nivir / kitti_lidar.py
Created November 2, 2017 19:05 — forked from ronrest/kitti_lidar.py
Visualize Lidar Data in Kitti Data
"""
VISUALISE THE LIDAR DATA FROM THE KITTI DATASET
Based on the sample code from
https://github.com/utiasSTARS/pykitti/blob/master/demos/demo_raw.py
And:
http://stackoverflow.com/a/37863912
Contains two methods of visualizing lidar data interactively.
- Matplotlib - very slow, and likely to crash, so only 1 out of every 100
@nivir
nivir / Question
Created May 7, 2017 22:13 — forked from elliatab/Question
Movie rating
using System;
using System.Collections.Generic;
namespace MyCollections
{
public class Movie {
private readonly int movieId;
private readonly float rating;
private List<Movie> similarMovies; // Similarity is bidirectional
@nivir
nivir / LSA.py
Created March 7, 2017 03:36 — forked from vgoklani/LSA.py
Latent Semantic Analysis (LSA) [simple example]
#!/usr/bin/python
# reference => http://www.puffinwarellc.com/index.php/news-and-articles/articles/33.html
from numpy import zeros
from scipy.linalg import svd
from math import log # needed for TFIDF
from numpy import asarray, sum
titles = ["The Neatest Little Guide to Stock Market Investing",
@nivir
nivir / hack.summit.2014.markdown
Created February 25, 2017 15:08 — forked from jaysoo/hack.summit.2014.markdown
Hack summit talks

Videos from hack.summit() 2014.

Day 1

Ed Roman - hack.summit() Opening remarks

Scott Hanselman - Author of multiple books on programming, podcaster, educator to half a million developers — Scaling Yourself

Floyd Marinescu - CEO, InfoQ — Culture and Happiness in Virtual Teams

@nivir
nivir / decorator.py
Created January 3, 2017 10:59
Decorator Basics - Python’s functions are objects
# http://stackoverflow.com/questions/739654/how-to-make-a-chain-of-function-decorators-in-python?rq=1
def shout(word="yes"):
return word.capitalize()+"!"
print(shout())
# outputs : 'Yes!'
# As an object, you can assign the function to a variable like any other object
scream = shout
@nivir
nivir / gist:5ab75e2aee816f7cfbfe6b22c60a9fc7
Created December 6, 2016 21:49
Django Error postgresql image not found
django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: dlopen(//anaconda/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Library not loaded: /Applications/Postgres.app/Contents/Versions/9.3/lib/libssl.1.0.0.dylib
Referenced from: //anaconda/lib/python2.7/site-packages/psycopg2/_psycopg.so
Reason: image not found
@nivir
nivir / gist:1dd844754e4eba81e3dfa1752a79ec68
Created December 6, 2016 21:26
Django server running
django.db.utils.OperationalError: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
django.db.utils.OperationalError: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
@nivir
nivir / gist:7e5b6884d7698783ac9fdc8790c58987
Created December 4, 2016 23:19
Django fe_sendauth error
*** Initializing server on localhost:8080 with medstack.settings.base
*** Running all tests
Syncing...
Traceback (most recent call last):
File "manage.py", line 9, in <module>
execute_from_command_line(sys.argv)
File "//anaconda/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "//anaconda/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)