Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / Question
Created May 7, 2017 22:13 — forked from r-julien-bataille/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 / 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
#!/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 / git-change-commit-messages.md
Created January 1, 2018 22:53 — forked from nepsilon/git-change-commit-messages.md
How to change your commit messages in Git? — First published in fullweb.io issue #55

How to change your commit messages in Git?

At some point you’ll find yourself in a situation where you need edit a commit message. That commit might already be pushed or not, be the most recent or burried below 10 other commits, but fear not, git has your back 🙂.

Not pushed + most recent commit:

git commit --amend

This will open your $EDITOR and let you change the message. Continue with your usual git push origin master.

@nivir
nivir / CMakeLists.txt
Created June 27, 2018 17:58 — forked from UnaNancyOwen/CMakeLists.txt
Drawing Point Cloud retrieve from Velodyne VLP-16
cmake_minimum_required( VERSION 2.8 )
# Create Project
project( solution )
add_executable( project main.cpp )
# Set StartUp Project (Option)
# (This setting is able to enable by using CMake 3.6.0 RC1 or later.)
set_property( DIRECTORY PROPERTY VS_STARTUP_PROJECT "project" )
@nivir
nivir / combinations.py
Created July 14, 2018 23:39 — forked from dougwt/combinations.py
Python: All Possible Combinations
def combinations(n, list, combos=[]):
# initialize combos during the first pass through
if combos is None:
combos = []
if len(list) == n:
# when list has been dwindeled down to size n
# check to see if the combo has already been found
# if not, add it to our list
if combos.count(list) == 0:
age operation_year axil_nodes status
30 64 1 1
30 62 3 1
30 65 0 1
31 59 2 1
31 65 4 1
33 58 10 1
33 60 0 1
34 59 0 2
34 66 9 2