Import existing project
This commit is contained in:
parent
7887817595
commit
80b0cc4939
125 changed files with 16980 additions and 0 deletions
398
develop/html/kb.html
Normal file
398
develop/html/kb.html
Normal file
|
|
@ -0,0 +1,398 @@
|
|||
<!doctype html>
|
||||
<html lang=en>
|
||||
|
||||
<head>
|
||||
<meta charset=UTF-8>
|
||||
<meta http-equiv=X-UA-Compatible content="IE=edge">
|
||||
<meta name=viewport content="width=device-width,initial-scale=1">
|
||||
<title>Caileb's Knowledgebase</title>
|
||||
<meta name=description content="Caileb's Knowledgebase">
|
||||
<link rel=icon href=/images/favi.png type=image/png>
|
||||
<link rel=apple-touch-icon href=/images/favi.png>
|
||||
<link rel="shortcut icon" href=/images/favi.png>
|
||||
<link rel=preload href=/webfonts/Poppins-Regular.woff2 as=font type=font/woff2 crossorigin>
|
||||
<link rel=preload href=/webfonts/Poppins-SemiBold.woff2 as=font type=font/woff2 crossorigin>
|
||||
<link rel="preload" href="/js/u.js" as="script">
|
||||
<link rel="stylesheet" href="/css/u.css">
|
||||
<style>
|
||||
:root {
|
||||
--background-color: #1e1e1e;
|
||||
--text-color: #cfcfcf;
|
||||
--heading-color: #ffffff;
|
||||
--code-block-bg: #333;
|
||||
--code-block-border: #4d9cfa;
|
||||
--code-color: #dcdcdc;
|
||||
--link-color: #4d9cfa;
|
||||
--link-hover-color: #4d9cfa;
|
||||
--input-border: #f39c12;
|
||||
--input-focus-border: #e67e22;
|
||||
--collapsible-bg: #2d2d2d;
|
||||
--collapsible-hover-bg: #3a3a3a;
|
||||
--scrollbar-bg: #2d2d2d;
|
||||
--scrollbar-thumb-bg: #4d9cfa;
|
||||
--scrollbar-thumb-hover-bg: #3971a3;
|
||||
--section-divider: #333;
|
||||
--section-accent: #f39c12;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--background-color);
|
||||
color: var(--text-color);
|
||||
margin: 0;
|
||||
line-height: 1.4;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 700px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
h1, h3, h4 {
|
||||
color: var(--heading-color);
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: var(--heading-color);
|
||||
margin-top: 0;
|
||||
margin-bottom: 15px;
|
||||
position: relative;
|
||||
padding-bottom: 10px;
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
h2:hover::before {
|
||||
content: "#";
|
||||
position: absolute;
|
||||
left: -1.6rem;
|
||||
color: var(--link-color);
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
h2::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: 12px;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
background: var(--section-accent);
|
||||
}
|
||||
|
||||
.section {
|
||||
margin-bottom: 40px;
|
||||
padding-bottom: 20px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.section::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 1px;
|
||||
background: linear-gradient(90deg,
|
||||
transparent,
|
||||
var(--section-divider) 10%,
|
||||
var(--section-divider) 90%,
|
||||
transparent);
|
||||
}
|
||||
|
||||
.section:last-child::after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.code-block {
|
||||
background-color: var(--code-block-bg);
|
||||
color: var(--heading-color);
|
||||
padding: 10px;
|
||||
border-radius: 5px;
|
||||
overflow-x: auto;
|
||||
white-space: nowrap;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
margin-bottom: 20px;
|
||||
border: 1px solid var(--code-block-border)
|
||||
}
|
||||
|
||||
.code-block.command::before {
|
||||
content: "$";
|
||||
color: var(--code-block-border);
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
top: 11px;
|
||||
font-family: Consolas, "Courier New", monospace
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: Consolas, "Courier New", monospace;
|
||||
color: var(--code-color)
|
||||
}
|
||||
|
||||
code.command {
|
||||
padding-left: 15px
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--link-color);
|
||||
text-decoration: none
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline
|
||||
}
|
||||
|
||||
.collapsible-label {
|
||||
background-color: var(--collapsible-bg);
|
||||
color: var(--text-color);
|
||||
cursor: pointer;
|
||||
padding: 10px;
|
||||
width: 100%;
|
||||
border: 2px solid var(--input-border);
|
||||
text-align: left;
|
||||
outline: 0;
|
||||
font-size: 18px;
|
||||
border-radius: 5px 5px 0 0;
|
||||
margin-bottom: 0;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
max-width: 700px;
|
||||
box-sizing: border-box;
|
||||
transition: background-color .3s, border-color .3s;
|
||||
position: relative;
|
||||
z-index: 2
|
||||
}
|
||||
|
||||
.collapsible-label:hover {
|
||||
background-color: var(--collapsible-hover-bg);
|
||||
border-color: var(--input-focus-border)
|
||||
}
|
||||
|
||||
.collapsible-input {
|
||||
display: none
|
||||
}
|
||||
|
||||
.content-wrapper {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
margin-bottom: 20px
|
||||
}
|
||||
|
||||
.content {
|
||||
max-height: 0;
|
||||
overflow: hidden;
|
||||
background-color: var(--collapsible-bg);
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
border: 2px solid transparent;
|
||||
border-top: none;
|
||||
transition: max-height .45s ease, padding .45s ease, border-color .45s ease;
|
||||
padding: 0 10px
|
||||
}
|
||||
|
||||
.collapsible-input:checked+.collapsible-label+.content {
|
||||
border-color: var(--input-border);
|
||||
padding: 10px
|
||||
}
|
||||
|
||||
.arrow {
|
||||
transition: transform .3s
|
||||
}
|
||||
|
||||
.collapsible-input:checked+.collapsible-label .arrow {
|
||||
transform: rotate(180deg)
|
||||
}
|
||||
|
||||
.step {
|
||||
margin-bottom: 20px
|
||||
}
|
||||
|
||||
.step h4 {
|
||||
margin-bottom: 10px
|
||||
}
|
||||
</style>
|
||||
<script src="/js/u.js" async></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="section" id="fail2ban">
|
||||
<h2>Fail2ban</h2>
|
||||
<div class="content-wrapper">
|
||||
<input type="checkbox" id="collapsible-fail2ban" class="collapsible-input">
|
||||
<label for="collapsible-fail2ban" class="collapsible-label">
|
||||
Setup Fail2ban
|
||||
<span class="arrow">▼</span>
|
||||
</label>
|
||||
<div class="content">
|
||||
<div class="step">
|
||||
<h4>Step 1: Install Fail2ban (Debian/Ubuntu)</h4>
|
||||
<p>First, install Fail2ban by running:</p>
|
||||
<div class="code-block command">
|
||||
<code class="command">sudo apt install fail2ban</code>
|
||||
</div>
|
||||
</div>
|
||||
<div class="step">
|
||||
<h4>Step 2: Navigate to the Fail2ban Directory</h4>
|
||||
<p>Change to the Fail2ban configuration directory:</p>
|
||||
<div class="code-block command">
|
||||
<code class="command">cd /etc/fail2ban/</code>
|
||||
</div>
|
||||
</div>
|
||||
<div class="step">
|
||||
<h4>Step 3: Copy the Example Configuration File</h4>
|
||||
<p>Copy the example configuration file as a base for your custom configuration:</p>
|
||||
<div class="code-block command">
|
||||
<code class="command">sudo cp jail.conf jail.local</code>
|
||||
</div>
|
||||
</div>
|
||||
<div class="step">
|
||||
<h4>Step 4: Create a New Filter</h4>
|
||||
<p>Navigate to the filter.d directory and create a new filter file:</p>
|
||||
<div class="code-block command">
|
||||
<code class="command">cd filter.d/</code>
|
||||
</div>
|
||||
<div class="code-block command">
|
||||
<code class="command">sudo nano nginx-4xx.conf</code>
|
||||
</div>
|
||||
</div>
|
||||
<div class="step">
|
||||
<h4>Step 5: Define the Filter to Block Repeated 4xx Errors</h4>
|
||||
<p>Add the following content to the <code>nginx-4xx.conf</code> file:</p>
|
||||
<div class="code-block">
|
||||
<code>[Definition]<br>failregex = ^<HOST>.*"(GET|POST|HEAD|CONNECT).*" (404|444|403|400) .*<br>ignoreregex = 127.0.0.1 127.0.0.0/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16</code>
|
||||
</div>
|
||||
</div>
|
||||
<div class="step">
|
||||
<h4>Step 6: Edit the Jail Configuration to Use the New Filter</h4>
|
||||
<p>Go back to the previous directory and edit <code>jail.local</code>:</p>
|
||||
<div class="code-block command">
|
||||
<code class="command">cd ..</code>
|
||||
</div>
|
||||
<div class="code-block command">
|
||||
<code class="command">sudo nano jail.local</code>
|
||||
</div>
|
||||
<p>Add the following section:</p>
|
||||
<div class="code-block">
|
||||
<code>#<br># Repeated 4xx errors (Nginx)<br>#<br>[nginx-4xx]<br>enabled = true<br>port = http,https<br>logpath = /var/log/nginx/access.log<br>maxretry = 4</code>
|
||||
</div>
|
||||
</div>
|
||||
<div class="step">
|
||||
<h4>Step 7: Restart Fail2ban for the Changes to Take Effect</h4>
|
||||
<p>Restart the Fail2ban service:</p>
|
||||
<div class="code-block command">
|
||||
<code class="command">sudo systemctl restart fail2ban</code>
|
||||
</div>
|
||||
</div>
|
||||
<div class="step">
|
||||
<h4>Step 8: Check the Filter Status</h4>
|
||||
<p>Verify the filter is working:</p>
|
||||
<div class="code-block command">
|
||||
<code class="command">sudo fail2ban-client status nginx-4xx</code>
|
||||
</div>
|
||||
<h4>OR</h4>
|
||||
<p>For a prettified output:</p>
|
||||
<div class="code-block command">
|
||||
<code class="command">sudo fail2ban-client get nginx-4xx banip | tr ' ' '\n'</code>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section" id="pm2">
|
||||
<h2>Node PM2</h2>
|
||||
<p>Restart</p>
|
||||
<pre class="code-block command">
|
||||
<code class="command">pm2 restart caileb.com</code>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="section" id="ffmpeg">
|
||||
<h2>FFmpeg</h2>
|
||||
<p>Highest quality AV1</p>
|
||||
<div class="code-block command">
|
||||
<code class="command">ffmpeg -i input -c:v av1_nvenc -preset p7 -cq 1 -b:v 0 -qmin 1 -qmax 5 -rc-lookahead 250 -spatial-aq 1 -aq-strength 15 -refs 16 -temporal-aq 1 -c:a flac -compression_level 8 highest_quality.mkv</code>
|
||||
</div>
|
||||
<p>Standard compression</p>
|
||||
<div class="code-block command">
|
||||
<code class="command">ffmpeg -i input -vf "mpdecimate" -fps_mode vfr -c:v av1_nvenc -preset p7 -cq 30 -b:v 0 -maxrate 18.5M -bufsize 25M -g 240 -keyint_min 24 -rc vbr -c:a libopus -b:a 128k compressed.webm</code>
|
||||
</div>
|
||||
<p>Extreme compression</p>
|
||||
<div class="code-block command">
|
||||
<code class="command">ffmpeg -i input -vf "mpdecimate,scale=-1:1080" -fps_mode vfr -c:v av1_nvenc -preset p7 -rc vbr -b:v 6M -maxrate 12M -bufsize 18M -g 300 -keyint_min 34 -c:a libopus -b:a 96k compressed.webm</code>
|
||||
</div>
|
||||
<p>Rocket.Chat</p>
|
||||
<div class="code-block command">
|
||||
<code class="command">ffmpeg -i input -vf "mpdecimate,scale=-1:1440" -fps_mode vfr -c:v av1_nvenc -preset p7 -rc vbr -b:v 8M -maxrate 15M -bufsize 22M -g 270 -keyint_min 28 -c:a libopus -b:a 112k rocket_chat.webm</code>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section" id="html">
|
||||
<h2>Useful HTML Stuffs</h2>
|
||||
<p>Make iFrames/Images Lazy Load <a href="https://developer.mozilla.org/docs/Web/Performance/Lazy_loading#images_and_iframes" target="_blank" rel="noopener noreferrer">MDN</a></p>
|
||||
<p>Replace FitVids or other similar JS libraries with CSS' aspect-ratio <a href="https://developer.mozilla.org/docs/Web/CSS/aspect-ratio" target="_blank" rel="noopener noreferrer">MDN</a></p>
|
||||
</div>
|
||||
|
||||
<div class="section" id="malware-removal">
|
||||
<h2>Malware Removal</h2>
|
||||
<ol>
|
||||
<li>
|
||||
<strong><a href="https://www.malwarebytes.com/mwb-download" target="_blank" rel="noopener noreferrer">Malwarebytes Free</a></strong>
|
||||
<p>Easy-to-use tool that quickly detects and removes a broad range of malware.</p>
|
||||
</li>
|
||||
<li>
|
||||
<strong><a href="https://www.emsisoft.com/home/emergency-kit/" target="_blank" rel="noopener noreferrer">Emsisoft Emergency Kit</a></strong>
|
||||
<p>Utilizes Bitdefender's engine on top of their own for a strong all-in-one cleanup.</p>
|
||||
</li>
|
||||
<li>
|
||||
<strong><a href="https://www.sophos.com/free-tools/virus-removal-tool" target="_blank" rel="noopener noreferrer">Sophos Scan & Clean</a></strong>
|
||||
<p>Portable scanner with effective heuristic analysis for detecting malware.</p>
|
||||
</li>
|
||||
<li>
|
||||
<strong><a href="https://www.kaspersky.com/downloads/free-virus-removal-tool" target="_blank" rel="noopener noreferrer">Kaspersky Virus Removal Tool</a></strong>
|
||||
<p>Efficiently finds and removes stubborn malware threats.</p>
|
||||
</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script defer>
|
||||
const collapsibleInputs = document.querySelectorAll(".collapsible-input");
|
||||
collapsibleInputs.forEach((input) => {
|
||||
input.addEventListener("change", function() {
|
||||
const content = this.nextElementSibling.nextElementSibling;
|
||||
content.style.maxHeight = this.checked ? content.scrollHeight + "px" : "0";
|
||||
});
|
||||
});
|
||||
|
||||
// Add click event to headers to update URL with section ID
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Get all h2 elements
|
||||
const headers = document.querySelectorAll('h2');
|
||||
|
||||
// Add click event listeners to each header
|
||||
headers.forEach(header => {
|
||||
header.addEventListener('click', function() {
|
||||
// Find the parent section with an ID
|
||||
const section = this.closest('.section');
|
||||
if (section && section.id) {
|
||||
// Update the URL without reloading the page
|
||||
history.pushState(null, null, `#${section.id}`);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in a new issue