Skip to content

Instantly share code, notes, and snippets.

View devendranaga's full-sized avatar
🍈

Dev devendranaga

🍈
  • <>
View GitHub Profile
@devendranaga
devendranaga / openssl_hashapi.cpp
Created February 5, 2019 02:31
create hash with openssl
/**
* Author: Devendra Naga <[email protected]>
*
* LICENSE MIT
*/
#include <iostream>
#include <string>
// for ERR_ functions
#include <openssl/err.h>
@devendranaga
devendranaga / arrow_keys.c
Created January 30, 2019 03:51
detect arrow keys in linux
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
int getch (void)
{
int ch;
struct termios oldt, newt;
tcgetattr(STDIN_FILENO, &oldt);
@devendranaga
devendranaga / rsa_keygen.c
Last active December 26, 2019 06:45
generate RSA key pair and write them to a file (openssl)
/**
* Author: Devendra Naga ([email protected])
* License: MIT
* Code failure paths are not taken care.. this program is only for demonstration purposes
*/
#include <stdio.h>
#include <openssl/rsa.h>
#include <openssl/evp.h>
#include <openssl/pem.h>
#include <iostream>
#include <vector>
int main()
{
std::vector<int> ints;
int i;
for (i = 0; i < 100; i ++) {
ints.push_back(i);
int list_add_tail(void *data)
{
struct linked_list *t;
t = malloc(sizeof(struct linked_list));
if (!t) {
return -1;
}
t->data = data;
@devendranaga
devendranaga / ActionActor.cpp
Created December 24, 2018 14:56
Action and Actor design class
#include <iostream>
#include <thread>
#include <unistd.h>
template <typename T1, typename T2>
class action {
public:
int registerPeriodicAction(T1 *data, T2 *specificCtx)
{
d = data;
@devendranaga
devendranaga / csvparser.cpp
Created December 12, 2018 05:14
simple CSV parser Class
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
class csvParse {
public:
csvParse(std::string input, std::vector<std::string> &output);
};

What is V2X

                        **Devendra Naga ([email protected])**

V2X is a vehicle to everything technology that allows the vehicles to be aware of their surroundings such as the other vehicles around it, enviornmental conditions, road conditions and many more.

This is an ongoing WIP document.. stay tuned for more.. i will update as and when i have free of time..

Intro

@devendranaga
devendranaga / timespec_diff.c
Created August 26, 2017 03:33 — forked from diabloneo/timespec_diff.c
Calculate diff of two struct timespec
#include <time.h>
void timespec_diff(struct timespec *start, struct timespec *stop,
struct timespec *result)
{
if ((stop->tv_nsec - start->tv_nsec) < 0) {
result->tv_sec = stop->tv_sec - start->tv_sec - 1;
result->tv_nsec = stop->tv_nsec - start->tv_nsec + 1000000000;
} else {
result->tv_sec = stop->tv_sec - start->tv_sec;
@devendranaga
devendranaga / nmea_checksum_creator.go
Created September 5, 2016 20:16
nmea checksum calculator in Golang
func nmea0183_checksum(nmea_in string) int {
check_sum:= 0
nmea_data := []byte(nmea_in)
for i:= 1; i < len(nmea_in) - 3; i ++ {
check_sum ^= (int)(nmea_data[i])
}