Skip to content

Instantly share code, notes, and snippets.

View ntakouris's full-sized avatar
🤖
Building robots

Theodoros Ntakouris ntakouris

🤖
Building robots
View GitHub Profile
/* Mode definitions */
#define MODE_INIT 0
#define MODE_MANUAL 1
#define MODE_GPS 2
#define MODE_LAND 3
static bool shutdown = false;
static int mode = MODE_INIT;
#define IMU_TIMES 2 // IMU read times per loop
h = 1/16 * [1, 4, 6, 4, 1];
sample_pts = -36:1:37;
signal = my_signal(sample_pts);
num_pts = size(signal, 2);
g_0 = conv(signal, h, 'same'); % smooth pre subsample
g_1 = g_0(1:2:end);
close all
clear
p200 = im2double(imread('photos/P200.jpg'));
[M N ~] = size(p200);
bench = im2double(imread('photos/bench.jpg'));
bench_m = im2double(imread('photos/bench_mask.jpg'));
cat = im2double(imread('photos/cat.jpg'));
cat_m = im2double(imread('photos/cat_mask.jpg'));
close all
clear
imga = im2double(imread('apple1.jpg'));
imgb = im2double(imread('orange1.jpg')); % size(imga) = size(imgb)
imga = imresize(imga,[size(imgb,1) size(imgb,2)]);
[M N ~] = size(imga);
v = 230;
level = 5;
limga = genPyr(imga,'lap',level); % the Laplacian pyramid
h = 1/16 * [1, 4, 6, 4, 1];
sample_pts = -36:1:37;
sample_pts_1 = sample_pts(1:2:end);
signal = my_signal(sample_pts);
num_pts = size(signal, 2);
h_ = [h zeros(1, num_pts - 5)];
private static IQueryable<Post> AddFiltersOnQuery(GetAllPostsFilter filter, IQueryable<Post> queryable)
{
if (!string.IsNullOrEmpty(filter?.UserId))
{
queryable = queryable.Where(x => x.UserId == filter.UserId);
}
// Add other filtering logic here
return queryable;
public RequestToDomainProfile()
{
CreateMap<PaginationQuery, PaginationFilter>();
CreateMap<GetAllPostsQuery, GetAllPostsFilter>();
}
[HttpGet(ApiRoutes.Posts.GetAll)]
[Cached(600)]
public async Task<IActionResult> GetAll([FromQuery] GetAllPostsQuery query, [FromQuery]PaginationQuery paginationQuery)
{
var pagination = _mapper.Map<PaginationFilter>(paginationQuery);
var filter = _mapper.Map<GetAllPostsFilter>(query);
var posts = await _postService.GetPostsAsync(filter, pagination);
var postsResponse = _mapper.Map<List<PostResponse>>(posts);
if (pagination == null || pagination.PageNumber < 1 || pagination.PageSize < 1)
// IPostService.cs
Task<List<Post>> GetPostsAsync(GetAllPostsFilter filter = null, PaginationFilter paginationFilter = null);
// PostsController.cs
public async Task<IActionResult> GetAll([FromQuery] GetAllPostsQuery query, [FromQuery]PaginationQuery paginationQuery)
public class GetAllPostsQuery
{
[FromQuery(Name = "userId")]
public string UserId { get; set; }
}