forked from AUEB-BALab/blockly_unix
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
378ad0f
commit a5c28e6
Showing
10 changed files
with
196 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Blockly Unix</title> | ||
<!-- Link to Bootstrap CSS --> | ||
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons/font/bootstrap-icons.css" rel="stylesheet"> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous"> | ||
<!-- Link to custom CSS --> | ||
<link rel="stylesheet" href="homePage.css"> | ||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet"> | ||
|
||
<script> | ||
document.addEventListener('DOMContentLoaded', () => { | ||
fetch('/auth-token') | ||
.then((response) => response.json()) | ||
.then((data) => { | ||
const token = data.authToken; | ||
const user = data.user; | ||
if (!token) { | ||
// User is authenticated | ||
document.getElementById('loginHomePageButton').style.display = 'block'; | ||
document.getElementById('registerHomePageButton').style.display = 'block'; | ||
document.getElementById('registerSecondButtonHomePage').style.display = 'inline-block'; | ||
document.getElementById('getStartedButton').style.display = 'inline-block'; | ||
console.log('Token:', token); | ||
} else { | ||
document.getElementById('continueWithBlocklyButton').style.display = 'block'; | ||
document.getElementById('logoutHomePageButton').style.display = 'block'; | ||
document | ||
.getElementById('logoutHomePageButton') | ||
.addEventListener('click', () => { | ||
event.preventDefault(); | ||
document.getElementById('logoutForm').submit(); | ||
}); | ||
} | ||
}) | ||
.catch((error) => { | ||
console.error('Error fetching the token:', error); | ||
}); | ||
}); | ||
</script> | ||
</head> | ||
<body class="d-flex flex-column min-vh-100"> | ||
|
||
<!-- Navbar --> | ||
<nav class="navbar navbar-expand-lg navbar-light bg-light"> | ||
<div class="container-fluid"> | ||
<span class="navbar-brand d-flex align-items-center"> | ||
<img src="img/blockly_72.png" alt="" class="me-2"> | ||
Blockly Unix | ||
</span> | ||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> | ||
<span class="navbar-toggler-icon"></span> | ||
</button> | ||
<div class="collapse navbar-collapse" id="navbarSupportedContent"> | ||
<ul class="navbar-nav me-auto mb-2 mb-lg-0"> | ||
<li class="nav-item"> | ||
<a class="nav-link active" aria-current="page" href="/">Home</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link active" aria-current="page" href="/blockly_unix">Blockly</a> | ||
</li> | ||
<li class="nav-item"> | ||
<a class="nav-link active" aria-current="page" href="/tutorials">Tutorials</a> | ||
</li> | ||
</ul> | ||
<div class="d-flex align-items-center"> | ||
<a href="/login" class="btn btn-primary me-2" id="loginHomePageButton" style="display: none;">Login</a> | ||
<a href="/register" class="btn btn-outline-primary me-2" id="registerHomePageButton" style="display: none;">Register</a> | ||
<!-- | ||
<form class="d-flex" role="search"> | ||
<input class="form-control me-2" type="search" placeholder="Search" aria-label="Search"> | ||
<button class="btn btn-outline-primary" type="submit">Search</button> | ||
</form> | ||
--> | ||
</div> | ||
<div class="d-flex align-items-center"> | ||
<a href="/blockly_unix" class="btn btn-primary me-2" id="continueWithBlocklyButton" style="display: none;">Continue Where You Left Off</a> | ||
<a href="/" class="btn btn-outline-primary me-2" id="logoutHomePageButton" style="display: none;">Logout</a> | ||
<form id="logoutForm" action="/logout" method="DELETE" style="display: none;"> | ||
<input type="hidden" name="_method" value="DELETE" /> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</nav> | ||
<section id="faq" class="faq"> | ||
<div class="container"> | ||
|
||
<div class="section-title text-center" data-aos="fade-up"> | ||
<h1>Commonly used tasks and Blockly Unix solutions</h1> | ||
</div> | ||
|
||
<ul class="faq-list "> | ||
|
||
<li> | ||
<div data-bs-toggle="collapse" class="collapsed question" href="#faq1">Filter, Sort, Count, and Save Data Based on Specific Conditions<i class="bi bi-chevron-down icon-show"></i><i class="bi bi-chevron-up icon-close"></i></div> | ||
<div id="faq1" class="collapse" data-bs-parent=".faq-list"> | ||
<p> | ||
Filter lines from a file based on a specific condition, sort them, count unique occurrences, and save the top results to a new file. | ||
</p> | ||
<div class="image-container"> | ||
<img src="img/blockly_photo.png" alt="Blockly Unix" class="img-fluid" style="width: 700px; height: auto;"> | ||
</div> | ||
<p> | ||
The corresponding Unix command for this task is: <strong>awk -F';' ' $3 == "empt" ' test.txt | sort -r -k2 | uniq -c | head -n 50 > newFile.txt</strong> | ||
</p> | ||
</div> | ||
</li> | ||
<li> | ||
<div data-bs-toggle="collapse" href="#faq2" class="collapsed question">Removing Duplicate Lines and Sorting<i class="bi bi-chevron-down icon-show"></i><i class="bi bi-chevron-up icon-close"></i></div> | ||
<div id="faq2" class="collapse" data-bs-parent=".faq-list"> | ||
<p> | ||
Remove duplicate lines from a file and then sort the remaining lines. | ||
</p> | ||
<div class="image-container"> | ||
<img src="img/remove_duplicate_lines_and_sort.png" alt="Blockly Unix" class="img-fluid" style="width: 700px; height: auto;"> | ||
</div> | ||
<p> | ||
The corresponding Unix command for this task is: <strong>sort inputFile.txt | uniq > outputFile.txt</strong> | ||
</p> | ||
</div> | ||
</li> | ||
|
||
<li> | ||
<div data-bs-toggle="collapse" href="#faq3" class="collapsed question"> Filter Rows Based on a Pattern<i class="bi bi-chevron-down icon-show"></i><i class="bi bi-chevron-up icon-close"></i></div> | ||
<div id="faq3" class="collapse" data-bs-parent=".faq-list"> | ||
<p> | ||
Filter rows containing the word "error" in a log file. Then count the number of lines that contain the word "error." | ||
</p> | ||
<div class="image-container"> | ||
<img src="img/filter_rows_and_count_lines.png" alt="Blockly Unix" class="img-fluid" style="width: 700px; height: auto;"> | ||
</div> | ||
<p> | ||
The corresponding Unix command for this task is: <strong>grep "error" logFile.txt | wc -l</strong> | ||
</p> | ||
</div> | ||
</li> | ||
|
||
<li> | ||
<div data-bs-toggle="collapse" href="#faq4" class="collapsed question">Convert a List of URLs to Their Domain Names<i class="bi bi-chevron-down icon-show"></i><i class="bi bi-chevron-up icon-close"></i></div> | ||
<div id="faq4" class="collapse" data-bs-parent=".faq-list"> | ||
<p> | ||
Extract and count domain names from a list of URLs and save the top 15 most frequent domains to a new file. | ||
</p> | ||
<div class="image-container"> | ||
<img src="img/convert_domains.png" alt="Blockly Unix" class="img-fluid" style="width: 700px; height: auto;"> | ||
</div> | ||
<p> | ||
The corresponding Unix command for this task is: <strong>awk -F'/' ' -F'/' {print $3}}' ' urls.txt | sort | uniq -c | sort -r | head -n 15 > topdomains.txt</strong> | ||
</p> | ||
</div> | ||
</li> | ||
<li> | ||
<div data-bs-toggle="collapse" href="#faq5" class="collapsed question">Combining Multiple Files into One<i class="bi bi-chevron-down icon-show"></i><i class="bi bi-chevron-up icon-close"></i></div> | ||
<div id="faq5" class="collapse" data-bs-parent=".faq-list"> | ||
<p> | ||
Concatenate the contents of multiple files into a single file. | ||
</p> | ||
<div class="image-container"> | ||
<img src="img/combine_files.png" alt="Blockly Unix" class="img-fluid" style="width: 700px; height: auto;"> | ||
</div> | ||
<p> | ||
The corresponding Unix command for this task is: <strong>cat file1.txt file2.txt file3.txt > combinedFile.txt</strong> | ||
</p> | ||
</div> | ||
</li> | ||
<li> | ||
<div data-bs-toggle="collapse" href="#faq6" class="collapsed question">Extracting Specific Columns from a File and Saving to a New File<i class="bi bi-chevron-down icon-show"></i><i class="bi bi-chevron-up icon-close"></i></div> | ||
<div id="faq6" class="collapse" data-bs-parent=".faq-list"> | ||
<p> | ||
Extract columns 1 and 3 from a CSV file and save the output to a new file. | ||
</p> | ||
<div class="image-container"> | ||
<img src="img/extract_columns.png" alt="Blockly Unix" class="img-fluid" style="width: 700px; height: auto;"> | ||
</div> | ||
<p> | ||
The corresponding Unix command for this task is: <strong>cut -d',' -f'1,3' file.txt > extracted_columns.txt</strong> | ||
</p> | ||
</div> | ||
</li> | ||
</ul> | ||
|
||
</div> | ||
</section> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script> | ||
</body> |