Skip to content

Instantly share code, notes, and snippets.

@samjaninf
samjaninf / regex.custom.pm
Created June 19, 2024 02:58 — forked from ethanpil/regex.custom.pm
Custom regex rules for CSF/LFD and NginX plus Wordpress fail2ban plugin
#!/usr/bin/perl
###############################################################################
# Copyright 2006-2015, Way to the Web Limited
# URL: http://www.configserver.com
# Email: sales@waytotheweb.com
###############################################################################
sub custom_line {
my $line = shift;
my $lgfile = shift;
@samjaninf
samjaninf / rust-command-line-utilities.markdown
Created May 14, 2024 00:24 — forked from sts10/rust-command-line-utilities.markdown
A curated list of command-line utilities written in Rust

A curated list of command-line utilities written in Rust

Note: I have moved this list to a proper repository. I'll leave this gist up, but it won't be updated. To submit an idea, open a PR on the repo.

Note that I have not tried all of these personally, and cannot and do not vouch for all of the tools listed here. In most cases, the descriptions here are copied directly from their code repos. Some may have been abandoned. Investigate before installing/using.

The ones I use regularly include: bat, dust, fd, fend, hyperfine, miniserve, ripgrep, just, cargo-audit and cargo-wipe.

  • atuin: "Magical shell history"
  • bandwhich: Terminal bandwidth utilization tool
@samjaninf
samjaninf / tag_sonarr_radarr_media_with_overseer_users.py
Created January 4, 2024 07:00 — forked from HStep20/tag_sonarr_radarr_media_with_overseer_users.py
This script will read your Overseer data and create/apply user tags to all of your sonarr/radarr instances
"""
This script will read your Overseer data and create/apply user tags to all of your sonarr/radarr instances, then create a filter in each connected -arr application for the users you specify.
It is forward compatible with the future User Tagging feature of overseer, and formats the tag in the same 'id - lowercase username' pattern Overseer will
It only uses built in python libraries, so you should be able to download and run without much hassle.
NOTE: YOU ARE REQUIRED TO USE IP:PORT CONNECTIONS FOR YOUR SONARR/RADARR INSTANCES INSIDE OF OVERSEERR
This will NOT utilize docker-compose style hostnames at the moment, and I don't use them personally, so I don't see myself adding them
Steps to use:
@samjaninf
samjaninf / gist:6b0331daea07d59254c3db43a999bda8
Last active September 7, 2023 18:34
bad bots blocker for directadmin
# https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/blob/master/MANUAL-CONFIGURATION.md
# setup the bad bots blocker thing using steps 1-3 from the README
cd /usr/local/sbin/
sudo wget https://raw.githubusercontent.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/master/install-ngxblocker -O /usr/local/sbin/install-ngxblocker
sudo chmod +x /usr/local/sbin/install-ngxblocker
# run the install
sudo ./install-ngxblocker -x
# get updates, this is in a cron job
@samjaninf
samjaninf / wp_updates.sh
Created July 6, 2023 03:27
wordpress_updates
# Plugin updates
wp plugin update --all --allow-root
wp plugin update --all --skip-plugins --skip-themes --allow-root
# Theme updates
wp theme update --all --allow-root
wp theme update --all --skip-plugins --skip-themes --allow-root
# Core updates
wp core update --allow-root
@samjaninf
samjaninf / powershell.ps1
Created March 7, 2022 22:11
Sexy Powershell
# https://docs.microsoft.com/en-us/windows/terminal/tutorials/custom-prompt-setup
# Install a font from https://www.nerdfonts.com/font-downloads
# Install-Module -Name PowerShellGet -Force
# Install-Module PSReadLine -AllowPrerelease -Force
# Install-Module -Name posh-git -Scope CurrentUser
# Install-Module -Name oh-my-posh -Scope CurrentUser
# Install the Terminal-Icons module
# Install-Module -Name Terminal-Icons -Repository PSGallery
# This is an example of a macro that you might use to execute a command.
# This will add the command to history.
Resources marked with > are used, have been used, or are actively advocated in the threads. This applies for everything in the [Necessities] section.
[Necessities]
Hiragana & Katakana: http://www.realkana.com/
Kanji: http://kanjidamage.com/
Japanese IME: http://www.google.com/intl/ja/ime/
Anki Flashcards: http://ankisrs.net/
Genki (↓Bottom↓)
Tae Kim Japanese: http://www.guidetojapanese.org/learn/grammar
@samjaninf
samjaninf / Caddyfile
Created June 22, 2021 21:59 — forked from SkYNewZ/Caddyfile
Example Caddyfile for using as load balancer
{
# Enable Debug mode
debug
# Disable admin API
admin off
}
localhost {
# https://caddyserver.com/docs/caddyfile/directives/push
@samjaninf
samjaninf / mautic_full_crons.cron
Last active November 6, 2021 01:52
Full crons for mautic
# Recommended cron tasks for Mautic 2 in Cloudways.
# All tasks are ran as ###USERTORUNAS###
# Output is ignored to avoid log file overhead.
# --quiet is used to reduce MySQL overhead on some tasks.
# --max-contacts is used to prevent one object's backlog from locking updates for other object.
# SEGMENTS
# Update all segments.
*/5 * * * * ###USERTORUNAS### ###PATHTOPHP### ###PATHTOMAUTICINSTALL###/bin/console mautic:segments:update --max-contacts=10000 --quiet >/dev/null 2>&1