This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" Check web URL and list all redirections """ | |
import argparse | |
import requests | |
import sys | |
import time | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* friends.php - use Twitter API to export data (CSV format) on people you are following | |
Installation: | |
1. Install Twitter OAuth PHP library (https://github.com/abraham/twitteroauth) | |
2. Adjust twitteroauth.php include path below | |
3. Create Twitter application (https://dev.twitter.com/apps) | |
4. Fill in 4 Twitter app keys below | |
5. Adjust $fields array if you want different fields saved |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Demonstration of problem with large integers in JSON, and | |
a couple options for dealing with them as strings instead. | |
ref: | |
* http://php.net/manual/en/function.json-decode.php | |
* http://stackoverflow.com/questions/2907806/handling-big-user-ids-returned-by-fql-in-php | |
*/ | |
$json = <<<EOT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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 |
NewerOlder