Skip to content

Instantly share code, notes, and snippets.

View bcantoni's full-sized avatar

Brian Cantoni bcantoni

View GitHub Profile
@bcantoni
bcantoni / podcast.py
Last active April 27, 2016 03:54
Simple conversion from podcast subscription OPML file into Markdown text
#!/usr/local/bin/python
"""
Convert podcast OPML file into Markdown format suitable for blog posting
Brian Cantoni
"""
import opml
import codecs
import locale
import sys
@bcantoni
bcantoni / Vagrantfile
Created April 22, 2016 19:09
Vagrant configuration for running WPScan (https://github.com/wpscanteam/wpscan)
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provision "shell", privileged: true, inline: <<-SHELL1
apt-get update
apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev git -y
SHELL1
@bcantoni
bcantoni / checkurl.py
Last active January 6, 2023 00:48
A simple Python script to check a web link and report back on the redirects encountered
#!/usr/bin/env python
""" Check web URL and list all redirections """
import argparse
import requests
import sys
import time
@bcantoni
bcantoni / icheck.sh
Created July 2, 2018 19:42
Bash script for checking internet connection status and keeping a local log when it changes. Meant to be run at some regular interval as a cron job.
#!/bin/bash
# check internet connectivity status
# file 'status' contains last known status (online or offline)
# file 'status.log' has an entry every time status changes
source ./status
echo "last status: $status at $time"
if nc -zw1 google.com 443; then
echo "online"
if [[ "$status" = "online" ]]; then
@bcantoni
bcantoni / Dockerfile
Created October 25, 2019 01:28
Docker Powered WordPress
FROM wordpress:5.2.4-php7.2-apache
# replace stock plugins/themes with our own
RUN rm -rf /var/www/html/wp-content/{plugins,themes}
COPY --chown=www-data:www-data ./src /var/www/html/wp-content
@bcantoni
bcantoni / pricecharting.py
Created January 23, 2020 00:23
Barcode scanning used video games
#!/usr/bin/env python
'''
By just doing a HEAD operation, we can look at the location returned and extract game system and title:
$ curl -i --head "https://www.pricecharting.com/search-products?type=videogames&q=096427015055"
HTTP/2 307
content-type: text/html; charset=utf-8
location: https://www.pricecharting.com/game/nintendo-ds/cooking-mama-2-dinner-with-friends?q=096427015055
x-appengine-log-flush-count: 0
x-cloud-trace-context: 95201b263e270f913954a519333070f4