Skip to content

Instantly share code, notes, and snippets.

Brian Cantoni bcantoni

Block or report user

Report or block bcantoni

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bcantoni
bcantoni / Dockerfile
Created Oct 25, 2019
Docker Powered WordPress
View Dockerfile
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 / icheck.sh
Created Jul 2, 2018
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.
View icheck.sh
#!/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 / checkurl.py
Last active May 30, 2017
A simple Python script to check a web link and report back on the redirects encountered
View checkurl.py
#!/usr/bin/env python
""" Check web URL and list all redirections """
import argparse
import requests
import sys
import time
@bcantoni
bcantoni / Vagrantfile
Created Apr 22, 2016
Vagrant configuration for running WPScan (https://github.com/wpscanteam/wpscan)
View Vagrantfile
# -*- 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 / podcast.py
Last active Apr 27, 2016
Simple conversion from podcast subscription OPML file into Markdown text
View podcast.py
#!/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
View Cassandra Schemas
create KEYSPACE spark_demo WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'};
create table spark_demo.raw_files (filename text,line int, contents text, PRIMARY KEY(filename,line));
create table spark_demo.users (id int PRIMARY KEY );
create table spark_demo.movies (id int PRIMARY KEY, name text, year int);
create table spark_demo.ratings (id int PRIMARY KEY, user_id int, movie_id int, rating float );
@bcantoni
bcantoni / Vagrantfile
Created Sep 23, 2014
Example Vagrant configuration for use with Amazon Web Services (vagrant-aws plugin)
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrant on AWS Example
# Brian Cantoni
# This sample sets up 1 VM ('delta') with only Java installed.
# Adjustable settings
CFG_TZ = "US/Pacific" # timezone, like US/Pacific, US/Eastern, UTC, Europe/Warsaw, etc.
@bcantoni
bcantoni / Vagrantfile
Created Sep 15, 2014
Example of passing a host environment variable through to a guest, using Vagrant script provisioner
View Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# test setting a guest environment variable based on a host environment variable
# if FOO_BAR is set locally, create command to add it to .profile in the guest
env_var_cmd = ""
if ENV['FOO_BAR']
value = ENV['FOO_BAR']
env_var_cmd = <<CMD
@bcantoni
bcantoni / ImportExport.pm.diff
Created Apr 8, 2014
Mods needed for migrating my blog from MovableType 4.x to WordPress 3.8
View ImportExport.pm.diff
--- ImportExport.pm.bak 2014-04-01 12:45:00.873266322 -0400
+++ ImportExport.pm 2014-04-01 17:35:53.995130625 -0400
@@ -483,15 +483,14 @@
$tmpl->text(<<'TEXT');
AUTHOR: <$MTEntryAuthor strip_linefeeds="1"$>
TITLE: <$MTEntryTitle strip_linefeeds="1"$>
-BASENAME: <$MTEntryBasename$>
+BASENAME: <mt:IfNonEmpty tag="EntryKeywords"><$MTEntryKeywords$><mt:Else><$MTEntryTitle dirify="1"></mt:IfNonEmpty>
STATUS: <$MTEntryStatus strip_linefeeds="1"$>
ALLOW COMMENTS: <$MTEntryFlag flag="allow_comments"$>
@bcantoni
bcantoni / markdown.js
Created Nov 8, 2013
Bookmarklet: Copy page title and link in Markdown format
View markdown.js
javascript:var%20text='['+document.title+']('+location.href+')';window.prompt("Copy%20to%20clipboard:%20Ctrl+C,%20Enter",text);void(0);
You can’t perform that action at this time.