Skip to content

Instantly share code, notes, and snippets.

View jacknlliu's full-sized avatar

Jack Liu jacknlliu

  • State Key Laboratory of Robotics
  • China
View GitHub Profile
@jacknlliu
jacknlliu / DoubleSlider.py
Created April 5, 2019 11:19 — forked from dennis-tra/DoubleSlider.py
PyQt - QSlider for float or double values + tests
from PyQt5.QtWidgets import QSlider
class DoubleSlider(QSlider):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.decimals = 5
self._max_int = 10 ** self.decimals
super().setMinimum(0)
@jacknlliu
jacknlliu / candump.log
Created September 23, 2018 10:59 — forked from rishabhagarwal880/candump.log
schunk_lwa4p with ros_canopen
Script started on Wed Jul 12 11:53:45 2017
]0;rishabh@robotik-dev-1: ~/host/repositoriesrishabh@container robotik-dev-1:~/host/repositories$ candump can0
can0 000 [2] 82 03
can0 703 [1] 00
can0 603 [8] 2B 17 10 00 64 00 00 00
can0 583 [8] 60 17 10 00 00 00 00 00
can0 703 [1] 7F
can0 603 [8] 40 00 18 01 00 00 00 00
can0 583 [8] 43 00 18 01 83 01 00 00
can0 603 [8] 23 00 18 01 83 01 00 80
@jacknlliu
jacknlliu / posdef.py
Created September 4, 2018 09:44 — forked from fasiha/posdef.py
Python/Numpy port of John D’Errico’s implementation (https://www.mathworks.com/matlabcentral/fileexchange/42885-nearestspd) of Higham’s 1988 paper (https://doi.org/10.1016/0024-3795(88)90223-6), including a built-in unit test. License: whatever D’Errico’s license, since this is a port of that.
from numpy import linalg as la
def nearestPD(A):
"""Find the nearest positive-definite matrix to input
A Python/Numpy port of John D'Errico's `nearestSPD` MATLAB code [1], which
credits [2].
[1] https://www.mathworks.com/matlabcentral/fileexchange/42885-nearestspd
@jacknlliu
jacknlliu / bag2csv.py
Created May 4, 2018 02:54 — forked from razekmaiden/bag2csv.py
convert ROS bag to cvs files
'''
This script saves each topic in a bagfile as a csv.
Accepts a filename as an optional argument. Operates on all bagfiles in current directory if no argument provided
Usage1 (for one bag file):
python bag2csv.py filename.bag
Usage 2 (for all bag files in current directory):
python bag2csv.py
@jacknlliu
jacknlliu / gaussian-processes-1.ipynb
Created January 20, 2018 14:59 — forked from abridgland/gaussian-processes-1.ipynb
A Jupyter notebook to accompany Intro to Gaussian Processes - Part I at http://bridg.land/posts/gaussian-processes-1
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jacknlliu
jacknlliu / topics_to_ssv.py
Created November 13, 2017 02:38 — forked from garaemon/topics_to_ssv.py
a script to output the values of ros topics into a text file
#!/usr/bin/env python
import roslib
roslib.load_manifest("sensor_msgs")
roslib.load_manifest("message_filters")
roslib.load_manifest("rxtools")
import rospy
import rxtools
import rxtools.rosplot
import sys
@jacknlliu
jacknlliu / docker_descendants.py
Created November 3, 2017 01:20 — forked from altaurog/docker_descendants.py
Python3 script to find descendants of one or more docker images
#!/usr/bin/python3
#
# usage: python3 docker_descendants.py <image_id> ...
import sys
from subprocess import check_output
def main(images):
image_ids = set(images)
@jacknlliu
jacknlliu / parse-options.sh
Last active August 4, 2017 09:53 — forked from cosimo/parse-options.sh
Example of how to parse options with bash/getopt
#!/bin/bash
#
# Example of how to parse short/long options with 'getopt'
#
# getopt recognize the params and put unrecognize params after '--', so '--' is a very important flag for latter work.
# -o for options like: -v -h -n -s
# --long for options like: --verbose --dry-run --help --stack-szie
# and which options followed by a ':' will have format like -s 3, --stack-size 4 or -s=3 --stack-size=4
# -n: name of the shell script
@jacknlliu
jacknlliu / simple_args_parsing.sh
Created June 29, 2017 03:51 — forked from jehiah/simple_args_parsing.sh
a simple way to parse shell script arguments
#!/bin/sh
#
# a simple way to parse shell script arguments
#
# please edit and use to your hearts content
#
ENVIRONMENT="dev"
@jacknlliu
jacknlliu / gmm.py
Created June 13, 2017 09:28 — forked from bistaumanga/gmm.py
Gaussian Mixture Model using Expectation Maximization algorithm in python
# -*- coding: utf-8 -*-
"""
Created on Sat May 3 10:21:21 2014
@author: umb
"""
import numpy as np
class GMM: