Skip to content

Instantly share code, notes, and snippets.

@uglyrobot
uglyrobot / fetchdomaininfo.py
Created April 5, 2023 17:26
Take a list of domains and export a CSV of their IP info: country, isp, org, as, asname, proxy, hosting
import csv
import requests
import json
import time
import socket
# Set up the URL for the IP-API.com API endpoint
api_url = "http://ip-api.com/batch"
# Set up the fields to request from the API
@uglyrobot
uglyrobot / b2-restore.sh
Last active May 12, 2022 16:02
A bash script using the B2 CLI to restore Backblaze cloud storage deleted files for a given prefix in a bucket with parallel processing for speed.
#!/bin/sh
if [ -z "$1" ]
then
echo "No bucketname supplied."
exit 1
fi
if [ -z "$2" ]
then
echo "No prefix supplied (example 360/jkloxsuc/)."
@uglyrobot
uglyrobot / build-as3cf-aws3.sh
Last active February 26, 2021 20:16 — forked from ianmjones/build-as3cf-aws3.sh
A script for downloading the AWS PHP SDK v3, stripping down to S3 functionality and then applying a custom namespace.
#!/usr/bin/env bash
set -e
if [ ! -f infinite-uploads.php ]; then
echo 'This script must be run from the repository root.'
exit 1
fi
for PROG in composer find sed unzip
@uglyrobot
uglyrobot / mailgun_migrate_suppression_list.sh
Created October 16, 2020 21:53
When changing the domain you send from in Mailgun, it's a good idea to copy the existing suppression list to the new domain to prevent spikes in bounces and complaints.
#!/bin/bash
if [ -z "$1" ]
then
echo "Missing API Key argument!"
exit 1
fi
if [ -z "$2" ]
then
echo "Missing source domain!"
#!/bin/bash
FILENAME=`find . -type f -name "*.pot"`
if [[ -z "$FILENAME" ]] ; then
TEXTDOMAIN=`grep -m 1 --include=*.php "^Textdomain" * | awk -F' ' '{print $2}' | sed 's/[[:space:]]//g'`
if [[ -z "$TEXTDOMAIN" ]] ; then
echo "Please enter the textdomain:"
read TEXTDOMAIN
fi
@uglyrobot
uglyrobot / smush.sh
Created March 16, 2015 17:18
Cronjob for optimizing image uploads
#!/bin/bash
FOLDER1='/somepath/wp-content/uploads/'
FOLDER2='/somepath/wp-content/uploads/'
#pngs
for i in `find $FOLDER1 $FOLDER2 -mmin -1 -iname '*.png'`
do
BEFORE_SIZE=$(stat -c%s "$i")
optipng -o2 -preserve -quiet $i
AFTER_SIZE=$(stat -c%s "$i")
@uglyrobot
uglyrobot / package-plugin
Last active September 14, 2017 07:28
A shell script for easy tagging and clean zip packaging of a WordPress Plugin/Theme in git.
#!/bin/bash
if [[ $# -eq 0 ]] ; then
echo "Please enter a version number:"
read VERSION
else
VERSION=$1
fi
if [[ -z "$VERSION" ]] ; then
echo "Sorry, I need a version number!"