This file contains hidden or 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
# Version 2 | |
pip install requests bs4 gspread oauth2client | |
import csv | |
import logging | |
import os | |
import requests | |
import time | |
import datetime |
This file contains hidden or 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
# Image Compression and Conversion Script | |
# Author: Ben Lacey | |
# Version: 1.1 | |
# Website: benlacey.co.uk | |
# Changes made: | |
# 1. Added a new `--rename` argument to accept a template string | |
# 2. Created a `generate_filename_from_template` function to handle template substitutions | |
# 3. Updated the `process_image` function to include counter and use the template | |
# 4. Added logging to show renamed filenames |
This file contains hidden or 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
""" | |
Advanced Web Scraper with Playwright | |
This script demonstrates a robust web scraping approach using Playwright that: | |
- Uses proper browser headers to reduce detection | |
- Implements logging to track execution | |
- Follows scraping best practices | |
- Handles common scraping errors | |
- Saves scraped data to CSV | |
""" |
This file contains hidden or 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
#!/bin/bash | |
# Multi-Server IP Block Manager | |
# Author: Ben Lacey (https://benlacey.co.uk) | |
# Version: 1.1 | |
# Date: 2025-04-27 |
This file contains hidden or 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
#!/bin/bash | |
# Configuration | |
LOG_FILE="/var/log/apache2/access.log" | |
ERROR_LOG="/var/log/apache2/error.log" | |
HTACCESS_FILE="/var/www/html/.htaccess" | |
BLOCK_LOG="/var/log/ip_blocks.log" | |
DEFAULT_BLOCK_DAYS=7 | |
MAX_FAILED_ATTEMPTS=5 | |
THRESHOLD_PERIOD="10 minutes" |
This file contains hidden or 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
document.addEventListener('DOMContentLoaded', function() { | |
const video = document.getElementById('protected-video'); | |
// Prevent right-click menu (basic download blocking) | |
video.addEventListener('contextmenu', function(e) { | |
e.preventDefault(); | |
alert("Video downloading is not allowed"); | |
}); | |
// Disable controls that might allow download |
This file contains hidden or 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
For Laravel Socket.io implementation with authentication, here's a complete example: | |
// SERVER SIDE (Laravel) | |
// In your BroadcastServiceProvider.php | |
public function boot() | |
{ | |
Broadcast::routes(['middleware' => ['auth:api']]); | |
require base_path('routes/channels.php'); |