Skip to content

Instantly share code, notes, and snippets.

View chaddupuis's full-sized avatar

Chad Dupuis chaddupuis

View GitHub Profile
source ''
gem 'rails', '3.2.9'
# Postgres Database
gem 'pg'
# Twitter API
gem 'twitter'
chaddupuis / woo-to-processwire-urls.php
Created December 21, 2022 18:44
Woocommerce WP REST Api Transfer to Processwire Site
<?php namespace ProcessWire;
// Using the Woocommerce/WP REST API and bootstrapping a processwire site from the script,
// build a csv (to be imported into a processwire link rewrite/redirect module) to ensure
// no dead links after site migrations from woocommerce to processwire.
$st = new ProcessWire('/your/site/location/', 'https://yoururl.yours');
chaddupuis / wordpress-xml-migration-to-processwire.php
Created December 21, 2022 18:48
Wordpress XML Dump w/Images and WP Rest Api - Content Migration to Processwire
<?php namespace ProcessWire;
// Uses a bootstrapped processwire site from a php script to read in
// both an xml export with images and talk to existing live wp site
// via Rest API (json output) to move all content and images over to new site.
$bl = new ProcessWire('/your/location/', '');
// Read WP XML Export (with images from plugin)
$myposts = simplexml_load_file('your-wp-xml-dump.xml');
chaddupuis / processwire-shippingeasy-foxycart-api-integration.php
Created December 21, 2022 18:54
Processwire and Foxycart Integration with ShippingEasy Labels and Status Management
<?php namespace ProcessWire {
// Processwire Store Management with Foxycart (from JSON webhook) and ShippingEasy (API).
// Manages order status and sends customer data to shipping easy for label printing via dashboard.
$st = new ProcessWire('/your/', '');
} // END PW namespace
chaddupuis /
Created December 21, 2022 18:58
Borg Backup Bash Script to Hetzner Storage Box
## Backup websites and related files along with databases with borg to a storage box on hetzner.
## borg variables
## Must use borg >1.1 on deb 9 $ apt -t stretch-backports install borg-backup
export BORG_RSH="ssh -i /your/key"
export BORG_PASSPHRASE="yourpassphrase"
chaddupuis / processwire-google-merchant-csv.php
Created December 21, 2022 19:00
Google Merchant CSV Creation from Processwire - For Inclusion in Google Shopping
<?php namespace ProcessWire;
$st = new ProcessWire('/var/www/', '');
// gmerchant header
//id title description link condition price availability image link gtin mpn brand google product category
//product_to_google is a pw field - if 1 send it to google, if 0 do not send
$myGmerchantProducts = $st->pages->find("template=page-general-product|page-other-product, product_to_google=1, sort=title");
$howMany = 0;
chaddupuis / apt-update-upgrade.yml
Created December 21, 2022 19:03
Basic Ansible - APT Upgrade
- hosts: mytargets
become: true
- name: update apt repo and cache
chaddupuis / create-products-from-csv.php
Created December 21, 2022 19:07
Processwire CLI - Example Processing a CSV to Processwire Fields
<?php namespace ProcessWire;
// This is an example of the transfer of product data (could be anything)
// from a csv to their corresponding fields in a processwire template
// and creating the pages. This uses the processwire feature of instantiating
// an instance from a command line script to access global variables
// (
$st = new ProcessWire('/var/www/', '');
chaddupuis /
Created December 21, 2022 19:08
Use Google Drive from Linux as a Virtual Drive (Gnome GIO Library)
# alias to provide readable directory listings when using mounted google drives on linux
alias lg='gio list -a "standard::display-name"'
chaddupuis /
Created December 21, 2022 19:11
Django Image Scraping and Writing to S3 with NamedTemporaryFiles (no local copies)
from csv import DictReader
from django.core.files import File
import urllib.request
from urllib.request import urlopen
from tempfile import NamedTemporaryFile
from import BaseCommand
import time
from PIL import Image
from io import BytesIO
from django.core.files.base import ContentFile