Skip to content

Instantly share code, notes, and snippets.

View JamieWritesCode's full-sized avatar

Jamie Baker JamieWritesCode

View GitHub Profile
@JamieWritesCode
JamieWritesCode / deploy.sh
Created October 27, 2017 06:51
Forge deploy script for Node.js
cd /home/forge/default
git pull origin master
npm install --production
<?php
namespace App\Helpers;
/*
| BTCMarkets
| Exchange is in AUD.
|
| https://github.com/BTCMarkets/API/wiki/Introduction
|
@JamieWritesCode
JamieWritesCode / gist:812ba4254e17c9ab5d475ec111ea532b
Created January 30, 2017 04:44
Command to check recent ssh related auth.log for errors.
tail -n300 /var/log/auth.log | grep ssh
sudo apt-get install proftpd
sudo nano /etc/proftpd/proftpd.conf
# disable ipv6
# update server name
# set default root ~
# disable RequireValidShell
# set masqurade ip to external ip
# enable passive ports
@JamieWritesCode
JamieWritesCode / install_automysqlbackup.sh
Last active July 25, 2016 00:56
Installs and configures AutoMySQLBackup with a post backup script to change ownership of backups to the default user 'forge' on Laravel Forge.
# Install automysqlbackup
apt-get -y --force-yes install automysqlbackup
# Create post backup script
mkdir -p /home/forge/scripts
cat >/home/forge/scripts/mysql-backup-post.sh <<"EOF"
#!/bin/bash
find /var/lib/automysqlbackup -type f -exec chown root:forge {} \; -exec chmod 740 {} \;
@JamieWritesCode
JamieWritesCode / default.conf
Created May 27, 2016 03:28
Nginx Configuration for Bedrock Multisite install on Laravel Forge
# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/example.com/before/*;
server {
listen 80;
server_name example.com;
root /home/forge/example.com/web;
# FORGE SSL (DO NOT REMOVE!)
# ssl_certificate;
@JamieWritesCode
JamieWritesCode / primary_category.php
Created May 24, 2016 01:15 — forked from jawinn/primary_category.php
Display Primary Category (Yoast's WordPress SEO)
<?php
// SHOW YOAST PRIMARY CATEGORY, OR FIRST CATEGORY
$category = get_the_category();
$useCatLink = true;
// If post has a category assigned.
if ($category){
$category_display = '';
$category_link = '';
if ( class_exists('WPSEO_Primary_Term') )
@JamieWritesCode
JamieWritesCode / current_page_url.php
Last active May 24, 2016 00:59
Wordpress snippet to return current page URL from any template.
global $wp;
$current_url = home_url(add_query_arg(array(),$wp->request));
@JamieWritesCode
JamieWritesCode / wp-smtp.php
Last active August 23, 2016 06:33
Wordpress function to configure PHPMailer to use SMTP
add_action( 'phpmailer_init', 'wph_phpmailer_init' );
function wph_phpmailer_init( PHPMailer $phpmailer ) {
$phpmailer->IsSMTP();
$phpmailer->setFrom('NOREPLY@DOMAIN.COM', 'WEBSITE'); // default from address
$phpmailer->SMTPAuth = true; // enable SMTP authentication
$phpmailer->Port = 587; // set the SMTP server port
$phpmailer->Host = 'SMTP_HOST'; // SMTP server
$phpmailer->Username = 'SMTP_USERNAME'; // SMTP server username
$phpmailer->Password = 'SMTP_PASSWORD'; // SMTP server password
$phpmailer->SMTPSecure = 'tls';