Skip to content

Instantly share code, notes, and snippets.

View jagannath-sahoo's full-sized avatar

JAGANNATH SAHOO jagannath-sahoo

View GitHub Profile
@jagannath-sahoo
jagannath-sahoo / Linux_win.sh
Created July 1, 2024 16:34
Linux path to windows path
#!/bin/bash
# Get the drive letter and Linux path arguments
drive_letter="$1"
linux_path="$2"
# Check if arguments are provided
if [ -z "$drive_letter" ] || [ -z "$linux_path" ]
then
echo "Error: Please provide both drive letter and Linux file path as arguments."
@jagannath-sahoo
jagannath-sahoo / gist:b37055f2239355970b530d80cb141aa5
Created May 31, 2024 15:57
Compile and Strip Debug info from executable
Compile with debug information:
gcc -g -o main main.c
Separate the debug information:
objcopy --only-keep-debug main main.debug
or
cp main main.debug
strip --only-keep-debug main.debug
sed 's/\(<[^/]*[^>]*>\)\/\//\1>\</g' your_xml_file.xml
#!/bin/bash
# Get the current time
current_time=$(date +"%Y-%m-%d %H:%M:%S")
# Get the address range from the user
start_address=$1
end_address=$2
# Check if the address range is valid
@jagannath-sahoo
jagannath-sahoo / Even_Odd_Semaphore.c
Last active November 13, 2021 17:06
Even_Odd_Semaphore.
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <inttypes.h>
#include <semaphore.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
/************************************
@jagannath-sahoo
jagannath-sahoo / BBBConnectInternet.txt
Last active December 6, 2020 05:31
How to connect BBB with internet
1. Get the static Ip of beaglebone after connecting with pc and name space server to BBB
vi /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
get the BBB interface ip from Ubuntu
run command
sudo route add default gw 192.168.7.1 usb0
sudo route add default gw 192.168.6.1 usb1
2. On Ubuntu check for the interfaces
WAN: wlp3s0
@jagannath-sahoo
jagannath-sahoo / MsgQueue_Struct.c
Last active July 26, 2019 08:35
Implementation of Message queue with structure type variable as buffer
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file : main.c
* @brief : Main program body
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
@jagannath-sahoo
jagannath-sahoo / MessageQueue.c
Last active July 26, 2019 03:04
Example of Implementation of Message Queue in CMSIS RTOS2
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file : main.c
* @brief : Main program body
******************************************************************************
* @attention
*
* <h2><center>&copy; Copyright (c) 2019 STMicroelectronics.
* All rights reserved.</center></h2>
@jagannath-sahoo
jagannath-sahoo / PrintfHexFormatSp.c
Created July 24, 2019 15:50
Format Specifier for HEX BY Abdul ki magic
#include <stdio.h>
#include <stdint.h>
char hex_string[2];
int main(void)
{
uint8_t check_sum = 242;
sprintf(hex_string, "%02X", check_sum);
for(int i=0; i<4;i++)
@jagannath-sahoo
jagannath-sahoo / IntelHexParsingCode.
Last active July 19, 2019 01:19
Parsing hex bytes from Intelhex formatted string
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
typedef struct Intel_Hex{
uint8_t length;
uint32_t addr;
uint8_t record_type;