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 / 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:
@jacknlliu
jacknlliu / computation.py
Created January 11, 2017 01:42
computation python initial script
#! /usr/bin/env python3
import matplotlib.pyplot as plt
import numpy as np
from sympy import init_session
init_session()
%matplotlib tk
@jacknlliu
jacknlliu / input-double-array.cpp
Last active November 1, 2016 10:50
Input a double array from commandline
/**
* This is an example input a double number array from commandline
* input: [ d1 d2 d3 ]
* ouput: d1 d2 d3
*/
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
@jacknlliu
jacknlliu / float-equal.cpp
Last active November 1, 2016 10:22
Determine whether two float number is equal
#include "float-equal.hpp"
#include <iostream>
#include <math.h>
using namespace std;
int main(int argc, char const *argv[])
{
bool ret;
float a = 0.01;
@jacknlliu
jacknlliu / get-keyboard-hit-nonblock.c
Last active October 19, 2016 15:12
Listen and get keyboard input with nonblock way
#ifdef __WIN32
#include <conio.h>
#include <stdio.h>
#else
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
#include <fcntl.h>
@jacknlliu
jacknlliu / event_program_framework.cpp
Last active October 18, 2016 15:03
A framework for programs with event loop handler and thread like Qt main() function
// some global data for share
data global_for_share;
// define class class_main for all tasks
class class_main
{
public:
class_main(data* shared_data){
@jacknlliu
jacknlliu / ROS-Project-CMakeLists.txt
Created October 16, 2016 07:12
ROS Project CMakeLists.txt template
project(package_name)
## Find catkin macros and libraries, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
message_generation
)