dj snape

Linux: batch convert webp to png using ffmpeg

If you have some images in webp format, such as exported from Telegram’s “sticker” packs, and you want to convert them to standard png for use in other applications, I have written a small bash script which will convert all the webp files in a directory into png and then remove the webp files.

This requires that you have ffmpeg installed. If you don’t want the webp files deleted afterward just remove line 5.

If you find this useful let me know in the comments! I invite suggestions to improve upon it.

vertical server racks and clean cabling

PowerDNS Script to add new zones using pdnsutil

I recently began using PowerDNS, and it has a really nice command line utility called “pdnsutil” which is sadly under-documented, so I am sharing my bash script which creates a new zone and a reverse dns zone, using pdnsutil.

This script is extremely basic, and I welcome any efforts to fork and improve it.

Be sure to specify your own nameservers where I have placed ns1.nameserver.com and ns2.nameserver.com

The DKIM record is based on a ‘standard’ DKIM configuration that I use, yours may vary.

Monty Python spam skit

anti-spam script

I created a script to notify the abuse@ person for an IP address, while simultaneously banning that IP address for a time-period using fail2ban.

In my case this is useful for spam that I receive through a web based contact form. I don’t want to put a captcha on the form, and most of the spam was coming from the same IPs every day.

This script depends on curl, pcregrep and fail2ban. You could replace fail2ban with iptables however setting an expiration date with iptables alone is more complicated. Since I use fail2ban everywhere (and you should too), this method is just easier. pcregrep is required for doing a multi-line regex match.