Skip to content

Instantly share code, notes, and snippets.


Kevin Firko firxworx

View GitHub Profile
firxworx / .editorconfig
Created Feb 27, 2021
Generic editorconfig for web projects
View .editorconfig
root = true
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_size = 2
firxworx / app.e2e-spec.ts
Created Jun 29, 2020
NestJS Integration/E2E Testing Example with TypeORM, Postgres, JWT
View app.e2e-spec.ts
import { Test, TestingModule } from '@nestjs/testing'
import { INestApplication, LoggerService } from '@nestjs/common'
import * as request from 'supertest'
import { AppModule } from './../src/app.module'
class TestLogger implements LoggerService {
log(message: string) {}
error(message: string, trace: string) {}
warn(message: string) {}
debug(message: string) {}
firxworx /
Created Feb 5, 2019
Bash script to deploy a development WordPress to a local path on MacOS
# 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:
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 / 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
// the zendesk php api ( 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 /
Created Feb 20, 2018
Web scraping with python: download all files linked to from a given web page with BeautifulSoup, urllib, and shutil
import urllib
import shutil
import re
from pathlib import Path
from bs4 import BeautifulSoup
# target page containing links to the image files
target_page = ''
# local path
firxworx /
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
#!/bin/bash -e
# Author: Kevin Firko @firxworx ( from Bitcurve Systems ( - 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