Skip to content

Instantly share code, notes, and snippets.

View lukicdarkoo's full-sized avatar

Darko Lukić lukicdarkoo

View GitHub Profile
@lukicdarkoo
lukicdarkoo / main.c
Last active July 16, 2019 13:47
Example usage of emlearn
#include "stdio.h"
#include "sonar.h"
int main() {
float symbol[] = { 0.13545444218373617, 0.06881865114264074, 0.1435361586761664, 0.1748921999328592, 0.021482698616699204, 0.05181458327897204, 0.19727342985895033, 0.07068028111428455, 0.10442642349850652, 0.07397413931047846, 0.050278495886241045, 0.06736349405231731, 3.8110146724237617, 2.1771302499993337, -1.830551718201271, -1.619008391744408, 0.5797330871737123, 0.46868678568291017, -0.2979215770842604, 0.6410885473557744 };
int xclass = eml_net_predict(&sonar, symbol, 20);
printf("Predicted class: %d\n", xclass);
}
@lukicdarkoo
lukicdarkoo / demodulationwithnnets.ipynb
Last active June 16, 2019 12:12
FSK Demodulation with NNets
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lukicdarkoo
lukicdarkoo / hough.py
Last active April 7, 2019 14:45
Hough-Transformation for Circle
import numpy as np
def hough_circ(grad, radius, eps=0.1):
"""Performs Hough-Transformation for fixed size circles
Parameters
----------
grad: numpy.matrix
Binary image after canny
@lukicdarkoo
lukicdarkoo / configure.sh
Last active February 15, 2025 02:28
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 <[email protected]>
# 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 / install.sh
Last active June 14, 2020 15:50
CosmicPi configuration script
#!/bin/bash
# Usage: curl https://gist.githubusercontent.com/lukicdarkoo/e33e00c6780ad0215d3932b810a10e46/raw | sh
echo "In case of any issues please consult cosmicpi.org for help, or contact us via Facebook "
echo "--- Expand the file system ---"
sudo resize2fs /dev/mmcblk0p2
echo "--- Update OS ---"
sudo apt -y update
@lukicdarkoo
lukicdarkoo / TimeTest.js
Created April 14, 2018 16:01
[Medium] Node.js in Robotics
let startTime = process.hrtime();
if (centerPoint.getDistance(Mep.Position.getPosition()) < this.config.hazardObstacleDistance) {
let target = this._targetQueue.getTargetBack();
if (target !== null) {
let line = new Line(Mep.Position.getPosition(), target.getPoint());
if (line.isIntersectWithPolygon(polygon) === true) {
// this.emit('pathObstacleDetected', true);
}
}
}
@lukicdarkoo
lukicdarkoo / SmartVideoPlayer.js
Created March 2, 2018 19:22
Starts a YouTube video only when it is visible on screen
/*
* Starts a YouTube video only when it is visible on screen. If user stops the video
* it will not be played again.
*
* @example
* <iframe id="video-intro" width="100%" height="380px" src="https://www.youtube.com/embed/ZyOuAHrKX2c?rel=0&amp;controls=0&amp;showinfo=0&amp;enablejsapi=1" frameborder="0"></iframe>
* <script>
* new SmartVideoPlayer('video-intro');
* </script>
*/
@lukicdarkoo
lukicdarkoo / kinetic-ubuntu.sh
Last active December 31, 2017 13:01
ROS installation script
#!/bin/bash
# Usage `curl https://gist.githubusercontent.com/lukicdarkoo/1a448da0903e0a21fc77979b9e24c3b9/raw/99ae53ef92c4c1ca85e0e992e7b62098f74036b1/kinetic-ubuntu.sh | sh`
# Make ROS packages available
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
sudo apt update
# Install ROS
sudo apt install -y ros-kinetic-desktop-full
@lukicdarkoo
lukicdarkoo / performance.js
Last active December 13, 2017 19:17
Node.js Performance Test
/*
* The script allows fast performance comparison of Node.js interpreter (different version on different architectures).
* `curl https://gist.githubusercontent.com/lukicdarkoo/810dcac696ddd6fcc956fb6a5fdd9693/raw | node`
*/
// Functions
function calc(val) {
return {
'cos': Math.cos(val),
'sin': Math.sin(val)
@lukicdarkoo
lukicdarkoo / music.sh
Last active November 15, 2017 14:23
Music Flasher
#!/bin/bash
#
# Use following command to run the script:
# $ curl https://gist.githubusercontent.com/lukicdarkoo/3ff2af3f739ee8ead98da950747a3db9/raw/a998c45fde127ee58808f55db3cd53b6ceded88d/music.sh | sh
#
# Created by Darko Lukic <[email protected]>
DEVICE=/dev/sdb