Skip to content

Instantly share code, notes, and snippets.

View ksvbka's full-sized avatar
💭
CFF - Code for food 👍

Trung Kien ksvbka

💭
CFF - Code for food 👍
View GitHub Profile
@ksvbka
ksvbka / inspire_hand.py
Created April 26, 2025 02:59
Control inspire_hand using python
import serial
import struct
# import numpy
# import string
# import binascii
import time
class InspireHandR:
def __init__(self):
// A simple quickref for Eigen. Add anything that's missing.
// Main author: Keir Mierle
#include <Eigen/Dense>
Matrix<double, 3, 3> A; // Fixed rows and cols. Same as Matrix3d.
Matrix<double, 3, Dynamic> B; // Fixed rows, dynamic cols.
Matrix<double, Dynamic, Dynamic> C; // Full dynamic. Same as MatrixXd.
Matrix<double, 3, 3, RowMajor> E; // Row major; default is column-major.
Matrix3f P, Q, R; // 3x3 float matrix.
/* Code a new node called pubvelsafe (in a new file pubvelsafe.cpp) in order to send:
* - A random angular velocity command and a fixed linear velocity of 1.0 when the
* turtle is placed in a safe zone defined by a square around the center of the window.
* - A random angular velocity and a random linear velocity (i.e. as done in pubvel.cpp)
* otherwise.
*/
#include <ros/ros.h>
#include <geometry_msgs/Twist.h>
#include <turtlesim/Pose.h>
@ksvbka
ksvbka / .clang-format-ros
Last active April 24, 2023 00:35
clang-format file for ROS develop, CppStyleGuide
BasedOnStyle: Google
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 2
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortLoopsOnASingleLine: false
@ksvbka
ksvbka / xavier-sd-resize.sh
Last active May 7, 2021 16:44
Auto resize SD card after dd copy - Jetson Xavier
#!/bin/bash
# Copyright (c) 2021, Trung Kien
# Copyright (c) 2019, Lufus
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
@ksvbka
ksvbka / install_pycuda.sh
Created May 7, 2021 14:07
Install pycuda for jetson xavier
#!/bin/bash
#
# Reference for installing 'pycuda': https://raw.githubusercontent.com/jkjung-avt/tensorrt_demos/master/ssd/install_pycuda.sh
# Fixed error not have nvcc
set -e
# Workaround to fixed error not have nvcc
export CUDA_HOME=/usr/local/cuda
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64
@ksvbka
ksvbka / qml-executable-stdout.qml
Created March 4, 2020 07:42
Get output from stdout when execute a command
import QtQuick 2.0
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0
import org.kde.plasma.core 2.0 as PlasmaCore
Item {
implicitWidth: label.implicitWidth
implicitHeight: label.implicitHeight
property string data: "?"
@ksvbka
ksvbka / c_cpp_properties.json
Last active February 21, 2020 04:41
Auto index include file QT and KDE
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/usr/include/c++/7",
"/usr/include/KF5/**",
"/usr/include/x86_64-linux-gnu/qt5/**",
"/usr/include/x86_64-linux-gnu/c++/7"
@ksvbka
ksvbka / snippets.json
Last active January 2, 2020 07:53
Plasma-workspace Snipet for vscode
{
"alias": {
"prefix": "alias",
"body": "property alias ${1:name}: ${2:val}",
"description": "QML property alias",
"scope": "source.qml"
},
"anchors": {
"prefix": "anchors",
"body": "anchors.${1}: ${2:parent}.${3}",
@ksvbka
ksvbka / main.cpp
Created October 28, 2019 16:51
QThread demo using worker model
#include <QApplication>
#include <QObject>
#include <QTextEdit>
#include <QThread>
#include <QVBoxLayout>
#include <QWidget>
#include <QtWidgets>
class Worker : public QObject {
Q_OBJECT