Skip to content

Instantly share code, notes, and snippets.

#include<stdio.h>
#include<stdlib.h>
void polynomial_insert(int *poly,int poly_size);
void polynomial_add(int *poly_1,int *poly_2,int *add,int poly_1_size,int poly_2_size);
void polynomial_display(int *poly,int poly_size);
int main()
{
int p1_size,p2_size,size,i;
@krishnan793
krishnan793 / Create_Delete_Folders.c
Created December 18, 2014 15:54
Create and Delete 'n' no: of Folders
#include<stdio.h>
#include<io.h>
void create_folder(int n)
{
int i;
char name[256];
for(i=0;i<n;i++)
{
@krishnan793
krishnan793 / Flooding_RAM.c
Last active May 3, 2017 16:49
Use the entire RAM space using dynamic memory allocation. Will also display the memory it is using.
#include<stdio.h>
#include<stdlib.h>
/*Struct flood require 256*4=1Kb */
struct flood{
long int a[256];
}*temp;
void main()
@krishnan793
krishnan793 / Thresholding_animation.m
Created December 18, 2014 16:08
Mat lab code to display shareholding effect.
%Dialog Box to browse and select image
[name path]=uigetfile({'*.jpg','IMAGE Files (*.jpg)'},'Choose Image for Thresholding');
A=imread(strcat(path,name));
%converting rgb to gray
A=rgb2gray(A);
for i=1:255
figure(1),imshow(A,[i 255-i]);
pause(0.01);
end
@krishnan793
krishnan793 / expect_telnet.sh
Created December 18, 2014 16:20
Automating scripts using expect
#! /usr/bin/expect -f
spawn telnet 192.168.1.1
expect "Login:"
send "username\r"
expect "Password:"
send "password\r"
sleep 1
send "?\r"
interact
@krishnan793
krishnan793 / linear_transform.m
Last active August 29, 2015 14:11
Linear Transformation or Negative of an Image
A=imread('401566.jpg'); %Change 401566.jpg with your image file
A=rgb2gray(A);
imshow(255-A); %(L-1)-r;L=256(8 bit gray scale)
@krishnan793
krishnan793 / log_transform.m
Created December 18, 2014 16:36
Log transformation of an image.
%% Log Transform
% Equation s=c*log(1+r)
A=imread('401566.jpg');
A=rgb2gray(A);
imshow(log(double(A)+1));
@krishnan793
krishnan793 / Power_Law_Transformation.m
Created December 18, 2014 16:38
Power law transformation of an image.
%% Power-Law Transformation
% Equation s=cr^a
A=imread('401566.jpg');
A=rgb2gray(A);
c=1;
a=2.2;
imshow(uint8(c*(double(A).^a)));
@krishnan793
krishnan793 / Dec2Hex.c
Last active January 11, 2020 03:50
Decimal to Hex Conversion using recursion.
#include<stdio.h>
void Dec2Hex(int no){
int hex=0;
if(!no)
return;
else {
hex=no%16;
Dec2Hex(no/16);
}
while true
do
echo 1 > /sys/class/gpio/gpio23/value
cat /sys/class/gpio/gpio23/value
sleep 1
echo 0 > /sys/class/gpio/gpio23/value
cat /sys/class/gpio/gpio23/value
sleep 1
done