Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
82 changes: 82 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# Created by https://www.gitignore.io

### OSX ###
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml

# Translations
*.mo
*.pot

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Vagrant
.vagrant

Empty file added Igor_Smirnov/.gitkeep
Empty file.
48 changes: 48 additions & 0 deletions Igor_Smirnov/part1.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

#1 Download using shell
wget http://www.sec.gov/dera/data/Public-EDGAR-log-file-data/2017/Qtr2/log20170630.zip

#2 Unpack the log file
unzip log20170630.zip

if [[ ! -d ./log20170630 ]]
then
mkdir log20170630
fi

mv log20170630.csv ./log20170630/log20170630.csv


#3 Change owner of log file to your current user using chown
chown $USER:$USER log20170630.csv

#4 Change executive bit to a random.sh script using chmod
chmod +x random-picker.sh

#5 Execute the random-picker.sh script
./random-picker.sh

#6 Find the file using find
find / -name log20170630.csv 2> /dev/null

#7 Try to look for errors using your favorite editor
vim /usr/src/linux-raspi2-headers-5.3.0-1014/drivers/staging/greybus/tools/log20170630.csv

#8 Try to find errors using grep ------> error.csv
cat /usr/src/linux-raspi2-headers-5.3.0-1014/drivers/staging/greybus/tools/log20170630.csv | grep error > error.csv

#9 Tail last 500 lines of file ------> tail500.csv
tail -n 500 /usr/src/linux-raspi2-headers-5.3.0-1014/drivers/staging/greybus/tools/log20170630.csv > tail500.csv

#10 Find how many index.htm hits were at 30.06.2017 14:00 ------> 10416
cat /usr/src/linux-raspi2-headers-5.3.0-1014/drivers/staging/greybus/tools/log20170630.csv | grep "2017-06-30,14:00:[0-5][0-9]" | grep "index.htm" | wc -l

#11 Find how many index.htm hits were at 30.06.2017 17:00-18:00 ------> 409996
cat /usr/src/linux-raspi2-headers-5.3.0-1014/drivers/staging/greybus/tools/log20170630.csv | grep "2017-06-30,1[7]:[0-5][0-9]:[0-5][0-9]" | grep "index.htm" | wc -l

#13 Show the number of times each IP shows up in the log – using sort and uniq utilities ------> ip_count.csv
cut -d, -f1 /usr/src/linux-raspi2-headers-5.3.0-1014/drivers/staging/greybus/tools/log20170630.csv | sort | uniq -ic > ip_count.csv

#14 Count all 13.94.212.jdf IP hits us ------> 87313
cat ip_count.csv | grep 13.94.212.jdf | grep -Eo '^[^ ]+'
11 changes: 11 additions & 0 deletions Igor_Smirnov/part2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!bin/bash

#1 add ubuntu user to adm and root groups using sed
sed -i 's/^root.*/&ubuntu/g' /etc/group
sed -i 's/^adm.*/&,ubuntu/g' /etc/group

#2 Change timezone to Europe/Berlin in /etc/timezone using sed
sed -i 's/Minsk/Berlin' /etc/timezone

#3 Change timezone to Europe/Minsk using bash shell utilites and apply it using system commands
timedatectl set-timezone Europe/Minsk
14 changes: 14 additions & 0 deletions Igor_Smirnov/part3.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash


#1 Examine ls using strace command
apt-get install strace
strace ls ./

#2 Assess how Linux executes the ./random_picker.sh script
touch ./log20170630/log20170630.csv
strace ./random_picker.sh

#3 Count number of 'mv' commands paths using pipes and grep for strace ./random_picker.sh
strace ./random_picker.sh 2>&1 | grep mv | wc -l

5 changes: 5 additions & 0 deletions Igor_Smirnov/random_picker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
mv ./log20170630/log20170630.csv `find /usr -type d | shuf -n 1`