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
/* 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
@ksvbka
ksvbka / main.cpp
Last active October 28, 2019 16:54
QThread demo
#include <QtWidgets>
#include <QThread>
#include <QObject>
#include <QApplication>
#include <QWidget>
#include <QVBoxLayout>
#include <QTextEdit>
class Thread : public QThread
@ksvbka
ksvbka / client-v1.py
Last active May 10, 2023 07:47
Python Session bus demo
#!/usr/bin/env python3
# D-Bus Client V2 -- Session Bus
import dbus
bus = dbus.SessionBus()
session = bus.get_object("org.me.test_session", "/org/me/test_session")
interface1 = dbus.Interface(session, "org.me.test1")