Skip to content

Instantly share code, notes, and snippets.

Kevin Firko firxworx

Block or report user

Report or block firxworx

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
@firxworx
firxworx / deploy-wordpress.sh
Created Feb 5, 2019
Bash script to deploy a development WordPress to a local path on MacOS
View deploy-wordpress.sh
#!/bin/bash
# Create a new local WordPress development site on MacOS
# This script is intended for users who have configured MacOS Apache + a DNS server such as dnsmasq to automatically
# serve up folders created in a special directory with the URL pattern: "http://FOLDER_NAME.test"
#
# See my blog for how to set that up:
# https://firxworx.com/blog/it-devops/sysadmin/setting-up-a-local-development-environment-on-macos-for-lamp-wordpress-projects/
@firxworx
firxworx / .htaccess-snippet
Created Oct 31, 2018
Restrict access to files in the WordPress uploads folder so they can only be accessed by logged-in users
View .htaccess-snippet
# The following Apache .htaccess snippet should be included at the top of the .htaccess file in WordPress' root directory.
#
# Use this option only if you wish to manually modify the .htaccess file. To fully contain file restriction functionality
# inside a plugin you can use the mod_rewrite_rules filter as demonstrated in a commented-out block in plugin-snippet.php
#
# Note <IfModule mod_rewrite.c></IfModule> test is intentionally omitted to trigger an error if mod_rewrite is not available.
# BEGIN RestrictFileExample
# it is ok if WordPress also calls these two directives later on in the file
@firxworx
firxworx / zendesk-api-create-ticket-with-multiple-custom-fields-demo.php
Created Jun 27, 2018
Zendesk PHP API v2: Creating a Ticket with Multiple Custom Fields (Ticket Fields)
View zendesk-api-create-ticket-with-multiple-custom-fields-demo.php
<?php
// the zendesk php api (https://github.com/zendesk/zendesk_api_client_php) docs do not include
// examples for setting custom fields or multiple custom fields when creating a ticket.
// so here are a couple that work
// NOTE: to create fields in Zendesk UI:
// Admin (gear icon) -> "Ticket Fields" link in nav under 'Manage' heading -> Add Field
// the Custom Field ID (required for API call) is displayed at at the top of the field's edit page.
@firxworx
firxworx / scrape-images.py
Created Feb 20, 2018
Web scraping with python: download all files linked to from a given web page with BeautifulSoup, urllib, and shutil
View scrape-images.py
import urllib
import shutil
import re
from pathlib import Path
from bs4 import BeautifulSoup
# target page containing links to the image files
target_page = 'http://example.ca/image_links.php'
# local path
@firxworx
firxworx / vagrant-provision.sh
Created Jan 5, 2018
Vagrant shell provisioner (bash) - spin up tomcat7 + mysql, and deploy a java webapp (war file) on a fresh Ubuntu/Debian box
View vagrant-provision.sh
#!/bin/bash -e
# Author: Kevin Firko @firxworx (https://firxworx.com) from Bitcurve Systems (https://bitcurve.com) - 2017
# overview:
# installs and configures tomcat+mysql and then deploys a java webapp (war file) to a bare
# ubuntu 16.04+ (and similar Ubuntu/Debian distros) vagrant box when specified as a shell provisioner
# in a Vagrantfile. loading mysql timezone tables and basic postfix smtp config included.
# this script should also work on other ubuntu versions and debian boxes with minimal modification
You can’t perform that action at this time.