This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "FreeRTOS.h" | |
#include "task.h" | |
#include "queue.h" | |
#include "timers.h" | |
#include "semphr.h" | |
// Hardware abstraction layer includes (adjust for your platform) | |
#include "gpio.h" | |
#include "timer.h" | |
#include "uart.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Comparison of different double to int conversions with bit shifting | |
* Şamil Korkmaz, 10.07.2025 | |
*/ | |
class Main { | |
public static void main(String[] args) { | |
//double t = 123.456; | |
//double t = 256.4321e6; | |
double t = 258788556.8; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This script tests the latency of UDP DNS queries and TCP connections to a web server. | |
# See this post for more: https://simulinkforsoftwareengineers.blogspot.com/2025/04/udp-vs-tcp.html | |
# Şamil Korkmaz, 12.04.2025 | |
import socket | |
import time | |
def udp_dns_test(): | |
server = ("8.8.8.8", 53) | |
query = b'\xaa\xbb' + b'\x01\x00' + b'\x00\x01' + b'\x00\x00' + b'\x00\x00' + b'\x00\x00' # Header | |
query += b'\x03www\x06google\x03com\x00' + b'\x00\x01' + b'\x00\x01' # "www.google.com" A record |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// C/C++ integer overflow demo showing why compiler overflow warnings should be taken seriously. | |
// Example of possible overflow: If you have a uint32_t variable that holds time values in microseconds (us), | |
// the max amount of time it can hold is UINT32_MAX = (2^32 - 1) us = 71.6 minutes. | |
// A famous overflow example from 1996 caused by casting a 64bit float to 16bit signed int: https://en.wikipedia.org/wiki/Ariane_flight_V88 | |
// 12.04.2025, Şamil Korkmaz | |
#include <iostream> | |
#include <cstdint> | |
int main() { | |
uint32_t a = 2000000000; // less than max uint32_t value (UINT32_MAX) of 2^32 - 1 = 4294967295 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
UAV Target Tracking with ArduPilot | |
---------------------------------- | |
This script keeps a detected target UAV centered in the camera view | |
by sending appropriate commands to ArduPilot using attitude target control. | |
To install the required libraries, run: | |
pip install pymavlink opencv-python numpy | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.integrate import cumulative_trapezoid | |
from scipy.stats import norm | |
class KalmanFilter: | |
""" | |
Kalman Filter for 1D position/velocity estimation using IMU and GPS | |
""" | |
def __init__(self, dt, accel_noise_std, gps_noise_std): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Liseye Geçiş Sınavı (LGS) puan hesaplama | |
# Şamil Korkmaz, 31.01.2025 | |
# Öğrencinin yanlış ve boşları [2,1] = 2 yanlış, 1 boş | |
yanlis_bos = { | |
"Türkçe": [2, 1], | |
"Tarih": [0, 0], | |
"Din": [0, 0], | |
"Dil": [0, 0], | |
"Matematik": [1, 0], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Demo of deque (double-ended queue) with size limit and binary search to find closest value. | |
Şamil Korkmaz, 20.01.2025 */ | |
#include <deque> | |
#include <vector> | |
#include <mutex> // std::unique_lock blocks all other threads, used for write operations | |
#include <shared_mutex> // std::shared_lock allows multiple threads to read simultaneously | |
#include <thread> | |
#include <optional> // for std::optional | |
#include <stdexcept> // for std::runtime_error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This code demonstrates a simple fixed-size memory pool implementation. | |
// Memory is allocated and managed statically, avoiding heap allocation overhead. | |
// The implementation uses static storage for the pool and a boolean array to track usage. | |
// | |
// Key Features: | |
// - Allocate and deallocate fixed-size blocks from a pre-allocated pool. | |
// - Suitable for systems with strict memory constraints, like embedded systems. | |
// - Provides an example of avoiding dynamic memory (heap) allocation. | |
// Şamil Korkmaz, 09.01.2025 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Rectangle Tiling</title> | |
<style> | |
body { | |
font-family: sans-serif; | |
margin: 20px; | |
} |
NewerOlder