Skip to content

Instantly share code, notes, and snippets.

@fabriziosalmi
fabriziosalmi / ai_chatbot_encryption.html
Created November 4, 2023 17:28
AI chatbot encrypter/decrypter
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI chatbot encrypter/decrypter</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<style>
body {
background-color: #f7f7f7;
@fabriziosalmi
fabriziosalmi / gpt-dev-tools.md
Last active December 24, 2023 23:37
GPT Development Tools

Hi, on every your messages in the first row put such informations then your message content must be shown after a newline, as this example (replace values with real obtained values)

"⚙️ 1 | 🆔 Funny Name | 💻 developer | 🎚️ 50% | 🐞 0 | 🛡️ yes | 🚀 no | 🔠 1323"

header fields explanation:

  • Iteration Number (⚙️): To track the number of messages exchanged.
  • Label ID (🆔): A random funny name.
  • Mode (💻): To indicate the mode in which I'm operating (developer, as you mentioned).
  • Skill Level (🎚️): To indicate the craziness of the coding skills being simulated.
@fabriziosalmi
fabriziosalmi / image-optimizer.md
Created October 11, 2023 16:16
Wordpress Image Optimizer

Setup

  1. Create a new folder in your WordPress wp-content/plugins directory and name it image-optimizer.
  2. Inside this folder, create a PHP file named image-optimizer.php and paste the following code:
<?php
/**
 * Plugin Name: Image Optimizer
 * Description: Optimizes images in a given directory without loss of quality.
@fabriziosalmi
fabriziosalmi / create_db.py
Last active August 19, 2023 12:45
Create sqlite database from blacklists repo to save historical data
import sqlite3
import requests
from datetime import datetime
import os
# SQLite setup
DB_PATH = "blacklisted.db"
def setup_db():
conn = sqlite3.connect(DB_PATH)
# Sampling of security headers
http-response set-header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
http-response set-header X-Frame-Options "SAMEORIGIN"
http-response set-header X-XSS-Protection "1; mode=block"
http-response set-header Referrer-Policy "no-referrer-when-downgrade"
http-response set-header X-Content-Type-Options "nosniff"
http-response set-header Referrer-Policy "strict-origin-when-cross-origin"
http-response set-header Permissions-Policy "geolocation=(), microphone=()"
http-response set-header Content-Security-Policy-Report-Only ""
@fabriziosalmi
fabriziosalmi / broadcast.sh
Created July 2, 2021 09:35 — forked from BusterNeece/broadcast.sh
FunkyWayFM: The shell script used to merge the video feed and AzuraCast-powered radio feed into a single YouTube stream.
#! /bin/bash
VBR="1500k"
FPS="30"
QUAL="veryfast"
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2"
KEY=""
VIDEO_SOURCE="/home/ubuntu/video3.mp4"
@fabriziosalmi
fabriziosalmi / covid19_stats.php
Last active March 6, 2020 21:02
COVID19 stats php script
<?php
// use: http(s)://PHP_HOST/covid19_stats.php?date=03-03-2020
// data source: https://github.com/CSSEGISandData/COVID-19/tree/master/csse_covid_19_data/csse_covid_19_daily_reports
error_reporting(E_ERROR);
$url = "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_daily_reports/".$_GET["date"].".csv";
$data = file_get_contents($url);
file_put_contents("last.csv", $data);
$csv = array_map('str_getcsv', file('last.csv'));
foreach($csv as $row) {
@fabriziosalmi
fabriziosalmi / ssl_check_from_list.sh
Created October 27, 2019 15:56
SSL check from list
#!/bin/bash
output="/path/to/log.file"
input="/path/to/websites.list"
while IFS= read -r website
do
echo "$website" >> $output
openssl s_client -servername $website -connect $website:443 2>/dev/null | openssl x509 -noout -dates | grep After | cut -d"=" -f2 >> $output
done < "$input"
@fabriziosalmi
fabriziosalmi / check-certs.sh
Created October 27, 2019 15:45 — forked from cgmartin/check-certs.sh
Bash SSL Certificate Expiration Check
#!/bin/bash
TARGET="mysite.example.net";
RECIPIENT="hostmaster@mysite.example.net";
DAYS=7;
echo "checking if $TARGET expires in less than $DAYS days";
expirationdate=$(date -d "$(: | openssl s_client -connect $TARGET:443 -servername $TARGET 2>/dev/null \
| openssl x509 -text \
| grep 'Not After' \
|awk '{print $4,$5,$7}')" '+%s');
in7days=$(($(date +%s) + (86400*$DAYS)));
for i in `find path/pngfiles/ -type f -name "*.png"`; do optipng -preserve -strip all $i; done