Skip to content

Instantly share code, notes, and snippets.

View lukicdarkoo's full-sized avatar

Darko Lukić lukicdarkoo

View GitHub Profile
@lukicdarkoo
lukicdarkoo / decimate.py
Last active August 3, 2023 21:24
Decimate meshes with the Blender Python API
# Installation:
#
# pip3 install bpy
#
# Usage:
#
# python3 decimate.py /path/to/meshes/* --ratio 0.025
#
import bpy
@lukicdarkoo
lukicdarkoo / convert.py
Last active September 2, 2021 07:02
Webots VRML conversion script
# Converts rotation and translation VRML fields.
# It takes the clipboard content, applies transforms, and pastes the transformed VRML to the clipboard.
#
# Dependencies:
#
# pip3 install clipboard numpy transforms3d
# sudo apt install xclip
#
# GNOME SHORTCUT
# In GNOME, you can run the script as a keyboard shortcut.
@lukicdarkoo
lukicdarkoo / tutorial.md
Last active July 26, 2023 20:19
VNC with NVIDIA acceleration (without display)

Server Configuration

Install VirtualGL and TurboVNC

# Install VirtualGL
wget https://nav.dl.sourceforge.net/project/virtualgl/3.1/virtualgl_3.1_amd64.deb
sudo apt install ./virtualgl_3.1_amd64.deb

# Install TurboVNC
@lukicdarkoo
lukicdarkoo / Makefile
Created April 15, 2021 12:24
Plugin System using `dlopen`
all:
g++ -shared -fPIC MyPlugin.cpp -o myplugin.so
g++ main.cpp -o main -ldl
@lukicdarkoo
lukicdarkoo / actor_critic.py
Created March 25, 2021 21:57
Actor-Critic
import gym
import numpy as np
import torch
import torch.nn
from torch.nn.functional import smooth_l1_loss, relu, softmax
class ActorCriticNet(torch.nn.Module):
def __init__(self, n_states=4, n_hidden=128, n_actions=2):
super().__init__()
@lukicdarkoo
lukicdarkoo / arraycuckoo.c
Created November 24, 2020 09:39
Python Buffer Protocol Example
#include <Python.h>
typedef struct {
PyObject_HEAD char *arr;
int len;
} ArrayCuckoo;
static int ArrayCuckoo_init(ArrayCuckoo *self, PyObject *args, PyObject *kwds) {
self->len = 2;
self->arr = (char *)malloc(self->len * sizeof(char));
{
"configurations": [
{
"name": "ROS2 Foxy",
"browse": {
"databaseFilename": "",
"limitSymbolsToIncludedHeaders": true
},
"includePath": [
"/home/lukic/webots/include/controller/cpp",
@lukicdarkoo
lukicdarkoo / egpu.bash
Last active January 9, 2024 22:56
Computer Vision with NVIDIA eGPU Configuration
# This script prepares your machine for computer vision challenges (with NVIDIA).
# Tested with Ubuntu 20.04 LTS and NVIDIA GeForce GTX 1070 (Aorus Gaming Box enclosure).
# Reddit post: https://www.reddit.com/r/eGPU/comments/io94qq/linux_aorus_gaming_box_for_robotics_and_computer/
#
# The script does the following:
# * Installs NVIDIA driver
# * Installs NVIDIA CUDA Toolkit (`nvcc`)
# * Installs NVIDIA CUDA Deep Neural Network library (cuDNN)
# * Installs OpenCV with CUDA support (WIP)
# * Installs TensorFlow with CUDA support
@lukicdarkoo
lukicdarkoo / e-puck2.wbt
Last active September 6, 2020 16:42
Log Webots position
#VRML_SIM R2020b utf8
WorldInfo {
info [
"The model of the e-puck 2 robot"
]
title "e-puck simulation"
coordinateSystem "NUE"
}
Viewpoint {
orientation 0.04913069345659068 0.9922428678493876 0.11419398479121845 3.8679
@lukicdarkoo
lukicdarkoo / labelme2yolo.py
Created August 15, 2020 20:18
LabelMe to YOLO
"""
Converts LabelMe annotations to annotations compatible with YOLO.
The script does the following:
- cleans (!) the output directory and prepare it for training,
- splits the dataset on validation and training,
- converts all LabelMe annoations (*.json) to YOLO annoations (*.txt) and
- creates YOLO metadata (`.data`, `.names`, `train.txt` and `valid.txt`)
"""
import os