Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Садовников - 15 #60

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
d780acb
lab6 completed
Sep 28, 2015
f1c88ba
minor changes to lab6
Oct 1, 2015
1d0c51d
lab7 completed
Oct 1, 2015
483e79e
all unnecessary prints removed
Oct 1, 2015
e577e5c
lab8 completed
Oct 5, 2015
9f20964
Minor changes to lab6
Oct 17, 2015
32d79cb
Strange commit to lab6
Oct 18, 2015
0f8a93a
Everything has changed
Oct 18, 2015
20e323c
Major change to lab9
Oct 20, 2015
b559ec3
lab9 part 2 completed
Oct 23, 2015
d4c7359
lab10 and lab12 completed
Oct 31, 2015
b60e749
lab11 completed
Nov 2, 2015
51b06e6
lab13 completed
Nov 5, 2015
ff2e309
lab14 almost completed
Nov 8, 2015
79ba37c
lab14 completed
Nov 9, 2015
ddec08c
lab14 completed
Nov 9, 2015
aa014fa
Create lab16.py
Nov 14, 2015
2b881d4
Create tests4lab16.py
Nov 14, 2015
1b14ebd
Changes to lab7 and lab16
Nov 15, 2015
62101dc
Changes in lab12 and lab13
Nov 16, 2015
981b068
Minor changes in lab7
Nov 16, 2015
3770ab6
Corrections in lab10's algorithm
Nov 16, 2015
04e35ae
lab17 completed
Nov 22, 2015
6e7552f
union_find added
Nov 22, 2015
46d71d3
lab18 completed
Nov 28, 2015
74b6f57
lab19 completed
Dec 12, 2015
764fece
lab20 completed
Dec 16, 2015
4eaee8c
minor changes to union_find
Dec 20, 2015
1b5a48b
Update lab17.py
Dec 26, 2015
d206b72
lab14 corrected
Dec 26, 2015
9bee1d3
suffocation has ended
Jan 5, 2016
e622e0f
well, they're algs in a way
May 12, 2016
5840e84
lab228 created
Sep 23, 2016
5c0fa6a
alive.txt created
Sep 23, 2016
d1593c3
I did something decent
Sep 23, 2016
19f7820
task6 partly completed
Sep 23, 2016
5c80b52
Create bf.txt
Oct 31, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions OS/Task1.sh~
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
number=$RANDOM
a="a"
b="b"
c="c"
txt=".txt"
one="1"


echo $number
echo $(($number % 3))
for i in `seq 1 100`;
do
if [ "$(($number % 3))" = 0 ]; then
number=$RANDOM
the_file=$a$txt
echo $a > $the_file
a=$a$one
else
if [ "$(($number % 3))" = 1 ]; then
number=$RANDOM
the_file=$b$txt
echo $b > $the_file
b=$b$one
else
number=$RANDOM
the_file=$c$txt
echo $c > $the_file
c=$c$one
fi
fi
done
5 changes: 5 additions & 0 deletions OS/Task1/Search.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
100 Thomas Manager Sales $5,000
200 Jason Developer Technology $5,500
300 Raj Sysadmin Technology $7,000
400 Nisha Manager Marketing $9,500
500 Randy Manager Sales $6,000
5 changes: 5 additions & 0 deletions OS/Task1/Search.txt~
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
100 Thomas Manager Sales $5,000
200 Jason Developer Technology $5,500
300 Raj Sysadmin Technology $7,000
400 Nisha Manager Marketing $9,500
500 Randy Manager Sales $6,000
32 changes: 32 additions & 0 deletions OS/Task1/Task1a.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
number=$RANDOM
a="a"
b="b"
c="c"
txt=".txt"
one="1"


echo $number
echo $(($number % 3))
for i in `seq 1 100`;
do
if [ "$(($number % 3))" = 0 ]; then
number=$RANDOM
the_file=$a$txt
echo $a > $the_file
a=$a$one
else
if [ "$(($number % 3))" = 1 ]; then
number=$RANDOM
the_file=$b$txt
echo $b > $the_file
b=$b$one
else
number=$RANDOM
the_file=$c$txt
echo $c > $the_file
c=$c$one
fi
fi
done
1 change: 1 addition & 0 deletions OS/Task1/Task1b.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rm a*
5 changes: 5 additions & 0 deletions OS/Task1/Task1c.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
b="a"

for file in b*
do mv "$file" "$b$file"
done
7 changes: 7 additions & 0 deletions OS/Task1/Task1d.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
c="wow"
one="1"

for file in c*
do cp "$file" "$c$one"
c=$c$one
done
3 changes: 3 additions & 0 deletions OS/Task1/Task1e.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
read pattern
echo $pattern
grep "$pattern" Search.txt > Result.txt
3 changes: 3 additions & 0 deletions OS/Task1/Task1e.sh~
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
read pattern
echo $pattern
grep '$pattern' Search.txt > Result.txt
1 change: 1 addition & 0 deletions OS/Task1b.sh~
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rm a*
5 changes: 5 additions & 0 deletions OS/Task1c.sh~
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
b="a"

for file in b*
do mv "$file" "$b$file"
done
7 changes: 7 additions & 0 deletions OS/Task1d.sh~
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
c="wow"
one="1"

for file in c*
do cp "$file" "$c$one"
c=$c$one
done
17 changes: 17 additions & 0 deletions OS/Task2/Task1.hs~
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module Main where

nOD a b = if mod c d == 0
then d
else nOD (mod c d) d
where c = myMax a b
d = myMin a b

myMax :: (Ord a) => a -> a -> a
myMax a b = if a > b then a else b

myMin :: (Ord a) => a -> a -> a
myMin a b = if a < b then a else b

main = do a <- readLn
b <- readLn
print (nOD a b)
32 changes: 32 additions & 0 deletions OS/Task2/Task1.sh~
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
number=$RANDOM
a="a"
b="b"
c="c"
txt=".txt"
one="1"


echo $number
echo $(($number % 3))
for i in `seq 1 100`;
do
if [ "$(($number % 3))" = 0 ]; then
number=$RANDOM
the_file=$a$txt
echo $a > $the_file
a=$a$one
else
if [ "$(($number % 3))" = 1 ]; then
number=$RANDOM
the_file=$b$txt
echo $b > $the_file
b=$b$one
else
number=$RANDOM
the_file=$c$txt
echo $c > $the_file
c=$c$one
fi
fi
done
1 change: 1 addition & 0 deletions OS/Task2/Task1b.sh~
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rm a*
7 changes: 7 additions & 0 deletions OS/Task2/Task1d.sh~
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
c="wow"
one="1"

for file in c*
do cp "$file" "$c$one"
c=$c$one
done
Binary file added OS/Task2/Task2
Binary file not shown.
120 changes: 120 additions & 0 deletions OS/Task2/Task2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <limits.h>


#define BUFFERSIZE 1024
#define COPYMORE 0644




int copyDir(char *src, char *dest);
int copyFiles(char *src, char *dest);
int dostat(char *filename);
int mode_isReg(struct stat info);




int main(int ac, char *av[])
{

if(ac != 3)
{
fprintf(stderr, "usage: %s source destination\n", *av);
exit(1);
}

char src[PATH_MAX+1];
strcpy(src, av[1]);
char dest[PATH_MAX+1];
strcpy(dest, av[2]);

if( src[0] != '/' && dest[0] != '/' )//cp1 file1.txt file2.txt
{
copyFiles(src, dest);
}
else if( src[0] != '/' && dest[0] == '/' )//cp1 file1.txt /dir
{
strcat(dest, "/");
strcat(dest, src);


copyFiles(src, dest);
}
else //cp1 /dir1 /dir2
{
copyDir(src, dest);
}
}


int copyDir(char *source, char *destination)
{
DIR *dir_ptr = NULL;
struct dirent *direntp;
char tempDest[strlen(destination)+228];
char tempSrc[strlen(source)+228];
strcat(destination, "/");
strcpy(tempDest, destination);
strcat(source, "/");
strcpy(tempSrc, source);

struct stat fileinfo;


if( (dir_ptr = opendir(source)) == NULL )
{
fprintf(stderr, "cp1: cannot open %s for copying\n", source);
return 0;
}
else
{
while( (direntp = readdir(dir_ptr)))
{


strcat(tempDest, direntp->d_name);
strcat(tempSrc, direntp->d_name);
copyFiles(tempSrc, tempDest);
strcpy(tempDest, destination);
strcpy(tempSrc, source);

}
closedir(dir_ptr);
return 1;
}


}

int copyFiles(char *source, char *destination)
{

int in_fd, out_fd, n_chars;
char buf[BUFFERSIZE];

in_fd=open(source, O_RDONLY);

out_fd=creat(destination, COPYMORE);


while( (n_chars = read(in_fd, buf, BUFFERSIZE)) > 0 )
{
write(out_fd, buf, n_chars);
}


close(in_fd);
close(out_fd);


return 1;
}
Loading