Skip to content

Instantly share code, notes, and snippets.

View copyleftdev's full-sized avatar

L337[e8f223b2]SIGMA copyleftdev

View GitHub Profile
@copyleftdev
copyleftdev / logs.md
Created August 24, 2024 06:53
Log Analysis Mastery: The Ultimate Cheat Sheet

📊 Log Analysis Mastery: The Ultimate Cheat Sheet

📜 Basic Log Viewing

Command Description Example
cat 📄 Display entire log file cat /var/log/syslog
less 📃 View log file with pagination less /var/log/auth.log
tail 🔚 View end of log file tail /var/log/apache2/access.log
head 🔝 View beginning of log file head /var/log/mysql/error.log
@copyleftdev
copyleftdev / parallel.md
Created August 24, 2024 06:51
GNU Parallel Mastery: The Ultimate Cheat Sheet

🚀 GNU Parallel Mastery: The Ultimate Cheat Sheet

📊 Basic Usage

Command Description Example
parallel echo ::: A B C 🔤 Process items in parallel Output: A, B, C (in any order)
parallel echo {} ::: *.txt 🔍 Use {} as placeholder Echoes names of all .txt files
cat file.txt | parallel echo 📥 Read input from stdin Processes each line of file.txt
parallel -j4 command ::: item1 item2 item3 🔢 Limit to 4 jobs at a time Runs 'command' on items, max 4 parallel
@copyleftdev
copyleftdev / chaining.md
Created August 24, 2024 06:49
Bash Command Chaining Mastery: The Ultimate Cheat Sheet

🔗 Bash Command Chaining Mastery: The Ultimate Cheat Sheet

🔗 Basic Command Chaining

Operator Description Example
; 📊 Run commands sequentially echo "Hello"; echo "World"
&& ✅ Run next command only if previous succeeds mkdir dir && cd dir
|| ❌ Run next command only if previous fails ping -c1 google.com || echo "Offline"
| 🚿 Pipe output of one command to another ls -l | grep ".txt"
@copyleftdev
copyleftdev / ssh-mastery.md
Created August 24, 2024 06:47
SSH Mastery: The Ultimate Guide

🔐 SSH Mastery: The Ultimate Guide

🌟 Basic SSH Commands

Command Description
ssh user@hostname 🔌 Connect to a remote host
ssh -p 2222 user@hostname 🔢 Connect using a specific port
ssh -i ~/.ssh/id_rsa user@hostname 🔑 Connect using a specific identity file
exit or logout 👋 Terminate the SSH session
@copyleftdev
copyleftdev / cheat-sheet.md
Created August 24, 2024 06:44
Ultimate Linux Terminal Tricks Cheatsheet

🚀 Ultimate Linux Terminal Tricks Cheatsheet

🧭 Navigation Ninja

Command Description
cd - 🔙 Teleport to previous directory
pushd <dir> 📚 Change directory, save current to stack
popd 📚 Return to most recently pushed directory
cd ~ 🏠 Go to home directory
@copyleftdev
copyleftdev / workflow.yml
Created April 22, 2024 16:00
Advanced GitHub Action Script for Stale Pull Request Management
name: Mark stale pull requests in Shepherd repo
on:
schedule:
- cron: '0 0 * * 1' # Runs every Monday at midnight
jobs:
stale:
runs-on: ubuntu-latest
timeout-minutes: 5
@copyleftdev
copyleftdev / index.html
Created October 25, 2022 04:15
Responsive hamburger menu - pure CSS #1
<header class="header">
<a href="" class="logo">CSS Nav</a>
<input class="menu-btn" type="checkbox" id="menu-btn" />
<label class="menu-icon" for="menu-btn"><span class="navicon"></span></label>
<ul class="menu">
<li><a href="#work">Our Work</a></li>
<li><a href="#about">About</a></li>
<li><a href="#careers">Careers</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
@copyleftdev
copyleftdev / file_search.py
Created February 13, 2020 05:51
file search
def search_file(term, fname):
with open(fname, "r") as filein:
content = filein.read()
if term in content:
return True
else:
return False
def term_check():
@copyleftdev
copyleftdev / py
Created January 18, 2019 02:02
regex
((?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Sept|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?) \s\d\s\d{1,2}:\d{1,2}:\d{1,2}\s)(did\d+)\s(inbound\[\d+\]):\s(FAX/VOICE):\s(service=\w+),\s(to=\w+),\s(utime=\d+),\s(page_cnt=\d+),\s(mode=\w+:\d+),\s(contact_ip=\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}),\s(vchan=\d+),\s(session=\d+),\s(res=\d+),\s(bps=\d+),\s(dur=\d+),\s(size=\d+),\s(skey=\d+),\s(ckey=\d+),\s(csid=\w+|\d+),\s(j2num=\w+|\d+),\s(did=\d+),\s(email=\d+@\w+.\w+.\w+.\w+\|2),\s+(msgid=)<(\w+-\d+-\d+-\d+)>,\s