Skip to content

Instantly share code, notes, and snippets.

View Nikhiladiga's full-sized avatar
🔍
Looking for new opportunities

Nikhil Adiga Nikhiladiga

🔍
Looking for new opportunities
View GitHub Profile
@Nikhiladiga
Nikhiladiga / interfaceStatus.cc
Created June 19, 2021 15:52
Get UP/DOWN status of network interface in Linux
#include <iostream>
#include <netinet/in.h>
#include <string.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <unistd.h>
int is_interface_online(std::string interface)
{
int fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
@Nikhiladiga
Nikhiladiga / CustomWebclient.java
Created April 19, 2022 06:31
Fully generic method to make synchronous http requests using Spring webclient
import java.io.File;
import java.util.List;
import java.util.Map;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.MediaType;
import org.springframework.http.client.MultipartBodyBuilder;
import org.springframework.util.MultiValueMap;
import org.springframework.web.reactive.function.BodyInserters;