Skip to content

Instantly share code, notes, and snippets.

View mstrYoda's full-sized avatar
🎧
Developing platform infrastructure. Microservices, CNCF, Kubernetes <3

Emre Savcı mstrYoda

🎧
Developing platform infrastructure. Microservices, CNCF, Kubernetes <3
View GitHub Profile
@mstrYoda
mstrYoda / c++ pthread
Created October 19, 2016 11:32
pthread join sample
#include "stdafx.h"
#include <cstdlib>
#include <iostream>
#define HAVE_STRUCT_TIMESPEC
// posix thread kütüphanesi
#include <pthread.h>
void *print_message_function(void *ptr);
int main() {
@mstrYoda
mstrYoda / gist:721cc755ee51bba3f704393ba35ad086
Created October 26, 2016 08:36
matlab basic sobel and prewitt edge detection
f=imread('coins.png');
subplot(2,4,1);imshow(f);
bw1 = edge(f,'prewitt');
subplot(2,4,2);imshow(bw1);
bw2 = edge(f,'sobel');
subplot(2,4,3);imshow(bw2);
@mstrYoda
mstrYoda / matlab filter - korelasyon
Created November 2, 2016 08:20
matlab filter - korelasyon
f=imread('coins.png');
kirli = imnoise(f,'salt & pepper',0.2);
%avarage
haverageFiltresi = fspecial('average',3);
averageFiltresi = imfilter(f,haverageFiltresi,'replicate');
%unsharped
unsharpFilter = fspecial('unsharp');
@mstrYoda
mstrYoda / gist:b9c72eb181aa2d4591840d8654023958
Created December 21, 2016 08:54
matlab regionprops example
I = imread('coins.png');
bw = im2bw(I, graythresh(I));
bw2 = imfill(bw,'holes');
s = regionprops(bw2, 'BoundingBox');
for k=1:length(s),
boundary = s(k).BoundingBox;
I2 = imcrop(I,boundary);
subplot(1,length(s),k),imshow(I2);
end
@mstrYoda
mstrYoda / SelectLambdaBuilder.cs
Last active September 29, 2021 10:21
Creating dynamically select lambda methods using expressions with c#
public class SelectLambdaBuilder<T>
{
private static Dictionary<Type, PropertyInfo[]> _typePropertyInfoMappings = new Dictionary<Type, PropertyInfo[]>();
private readonly Type _typeOfBaseClass = typeof(T);
private Dictionary<string, List<string>> GetFieldMapping(string fields)
{
if (string.IsNullOrEmpty(fields))
{
return null;
@mstrYoda
mstrYoda / example.java
Created August 12, 2018 13:32
Java LocalDate and Date example
public static void main(String[] args) throws IOException, ParseException {
String str = "Sun Jun 10 05:23:03 2018";
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("EEE MMM d HH:mm:ss yyyy");
System.out.println(LocalDate.parse(str, formatter));
DateFormat fmt = new SimpleDateFormat("EEE MMM dd HH:mm:ss yyyy", Locale.ENGLISH);
DateFormat targetFormat = new SimpleDateFormat("dd-MM-yyyy");
@mstrYoda
mstrYoda / controller.java
Created August 24, 2018 22:54
Java MultipartFile Controller for medium article
@RestController
@RequestMapping("/users")
public class UserController {
UserService userService;
@Autowired
public UserController(UserService userService) {
this.userService = userService;
}
@mstrYoda
mstrYoda / controllerTest.java
Created August 24, 2018 22:57
multipartfile controller unit test for medium
@RunWith(SpringRunner.class)
@WebMvcTest(UserController.class)
public class UserControllerTest {
@Autowired
MockMvc mockMvc;
@MockBean
UserService userService;
@Test
@mstrYoda
mstrYoda / simple-mapping.yaml
Created September 25, 2019 19:58
ambassador mapping.yaml
apiVersion: getambassador.io/v1
kind: Mapping
metadata:
 name: hello-node
spec:
 prefix: /hello
 service: http://hello-node:8080
type First struct {
a int16
b int32
c int16
}
type Second struct {
b int32
a int16
c int16