Skip to content

Instantly share code, notes, and snippets.

View Sahas-Ananth's full-sized avatar
🤖
Roboticist

Sahasrajit Anantharamakrishnan Sahas-Ananth

🤖
Roboticist
View GitHub Profile
@Sahas-Ananth
Sahas-Ananth / Enc_Dec.c
Created March 27, 2021 18:26
Simpler Shift Cipher encryption program using C
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
int main () {
char word[100];
int OFFSET = 1;
printf("Enter a string: ");
scanf("%s", word);
#!/usr/bin/env python3
graph = {
"A": ["B", "C"],
"B": ["C", "D"],
"C": ["D"],
"D": ["C"],
"E": ["F"],
"F": ["C"],
}
set ns [new Simulator]
#puts "Starting program..."
# Creating Output files
set namf [open stop_wait_protocol.nam w]
$ns namtrace-all $namf
set trf [open stop_wait_protocol.tr w]
$ns trace-all $trf
@Sahas-Ananth
Sahas-Ananth / error_detection_and_correction.c
Last active March 27, 2021 13:41
Error detection and correction
#include <stdio.h>
#include <stdio.h>
char data[5];
int encoded[8], edata[7], syndrome[3];
int hmatrix[3][7] = {1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1};
char gmatrix[4][8] = {"0111000", "1010100", "1100010", "1110001"};
int main() {
int i = 0, j = 0;
@Sahas-Ananth
Sahas-Ananth / echo_client.py
Created March 27, 2021 07:57
This gist containts two files a server and a client. The server echos back what is sent by the client. This is done by using socket programming in python
#!/usr/bin/env python3
# Library needed for socket programming
import socket
# Defining the header size
HEADER = 64
# Defining a port for the client to connect to
PORT = 5050
# Format specification of the message
FORMAT = "utf-8"