Skip to content

Instantly share code, notes, and snippets.

View lukicdarkoo's full-sized avatar

Darko Lukić lukicdarkoo

View GitHub Profile
@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 / configure.sh
Last active November 22, 2023 04:37
Raspberry Pi: AP + client mode
#!/bin/sh
# The script configures simultaneous AP and Managed Mode Wifi on Raspberry Pi Zero W (should also work on Raspberry Pi 3)
# Usage: curl https://gist.githubusercontent.com/lukicdarkoo/6b92d182d37d0a10400060d8344f86e4/raw | sh -s WifiSSID WifiPass APSSID APPass
# Licence: GPLv3
# Author: Darko Lukic <lukicdarkoo@gmail.com>
# Special thanks to: https://albeec13.github.io/2017/09/26/raspberry-pi-zero-w-simultaneous-ap-and-managed-mode-wifi/
MAC_ADDRESS="$(cat /sys/class/net/wlan0/address)"
CLIENT_SSID="${1}"
CLIENT_PASSPHRASE="${2}"
@lukicdarkoo
lukicdarkoo / demodulation.c
Last active November 11, 2023 01:38
QAM modulation in C without complex library
#include <math.h>
#include <stdio.h>
typedef struct _complex {
double imag;
double real;
} complex_t;
const int SAMPLE_RATE = 160E3;
const float FREQUENCY = 40E3;
@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
@lukicdarkoo
lukicdarkoo / FFT.c
Last active August 14, 2023 12:49
Basic implementation of Cooley-Tukey FFT algorithm in C++
#include "FFT.h"
void fft(int *x_in,
std::complex<double> *x_out,
int N) {
// Make copy of array and apply window
for (int i = 0; i < N; i++) {
x_out[i] = std::complex<double>(x_in[i], 0);
x_out[i] *= 1; // Window
@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 / 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 / fft.py
Created December 19, 2015 12:24
Basic implementation of Cooley-Tukey FFT algorithm in Python
'''
Basic implementation of Cooley-Tukey FFT algorithm in Python
Reference:
https://en.wikipedia.org/wiki/Fast_Fourier_transform
'''
__author__ = 'Darko Lukic'
__email__ = 'lukicdarkoo@gmail.com'
@lukicdarkoo
lukicdarkoo / configure.sh
Created July 30, 2019 09:32
USB OTG Console for Armbian
sudo su
echo 'g_serial' >> etc/modules
echo 'ttyGS0' >> etc/securetty
echo 'echo 2 > /sys/bus/platform/devices/sunxi_usb_udc/otg_role' > etc/init.d/otg_config.sh
chmod +x etc/init.d/otg_config.sh
{
"configurations": [
{
"name": "ROS2 Foxy",
"browse": {
"databaseFilename": "",
"limitSymbolsToIncludedHeaders": true
},
"includePath": [
"/home/lukic/webots/include/controller/cpp",