Skip to content

Instantly share code, notes, and snippets.

View RocketSharck's full-sized avatar

RocketSharck

View GitHub Profile
@RocketSharck
RocketSharck / PHP cleaner
Created March 24, 2018 13:56 — forked from gordonbanderson/PHP cleaner
Find leading and trailing space
<?php
/***********************
*@author: Ritesh Agrawal
*@description: Identifies php files that contain leading or trailing spaces before or after PHP opening or closings tags
*@version: 1.0
*@date: Nov 06, 2007
@todo – check only *.PHP or *.CTP files rather than checking all of the files
– html based output
***********************/
//Set Source Path
@RocketSharck
RocketSharck / tmux-cheatsheet.markdown
Created March 27, 2018 20:38 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@RocketSharck
RocketSharck / Instructions.sh
Created May 23, 2018 15:00 — forked from GhazanfarMir/Instructions.sh
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
########## Install NGINX ##############
# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common
# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable
# Update packages after adding ppa
@RocketSharck
RocketSharck / fix-wordpress-permissions.sh
Created May 23, 2018 15:18 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@RocketSharck
RocketSharck / custom-css.php
Created May 27, 2018 18:47 — forked from MohammedKaludi/custom-css.php
Add Custom CSS in AMPforWP via Hook
add_action('amp_post_template_css','ampforwp_add_custom_css_example', 11);
function ampforwp_add_custom_css_example() { ?>
/* Add your custom css here */
body {
background: red;
}
<?php
}
@RocketSharck
RocketSharck / yoast-seo-sitemap.php
Last active August 12, 2018 19:10 — forked from mohandere/yoast-seo-sitemap.php
Wordpress yoast seo plugin, generate custom sitemap for custom URLS
<?php
// add_filter( 'wpseo_enable_xml_sitemap_transient_caching', '__return_false');
/**
* Create a new custom yoast seo sitemap
*/
add_filter( 'wpseo_sitemap_index', 'ex_add_sitemap_custom_items' );
add_action( 'init', 'init_wpseo_do_sitemap_actions' );
@RocketSharck
RocketSharck / youtube.sh
Created August 22, 2018 18:31 — forked from dantheman213/youtube-dl_cheatsheet.md
youtube-dl cheatsheet -- Download entire youtube playlist and more!
# https://github.com/rg3/youtube-dl/
# On ubuntu: apt-get install libav-tools
# Download Playlist to batch of MP3s
youtube-dl -f bestvideo+bestaudio --extract-audio --audio-format mp3 --prefer-avconv --playlist-random https://www.youtube.com/playlist?list=XXXXX
# Download individual song
youtube-dl -f bestvideo+bestaudio --extract-audio --audio-format mp3 --prefer-avconv https://www.youtube.com/watch?v=ZZZZZZZ
@RocketSharck
RocketSharck / ubuntu-nginx-init-script
Created October 12, 2018 21:40 — forked from nurrony/ubuntu-nginx-init-script
Nginx init script for Ubuntu 14.04/14.10. Basically a copy of @JasonGiedymin but path is changed to use for default installation path of Nginx `/etc/nginx` using `apt-get`
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: nginx init.d dash script for Ubuntu or other *nix.
# Description: nginx init.d dash script for Ubuntu or other *nix.
### END INIT INFO
@RocketSharck
RocketSharck / nginx-webp-sample.conf
Created November 30, 2018 12:20 — forked from uhop/nginx-webp-sample.conf
Serving WEBP with nginx conditionally.
user www-data;
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
@RocketSharck
RocketSharck / class.envato2.php
Created December 12, 2018 17:01 — forked from dtbaker/class.envato2.php
Using the verify-purchase endpoint of the new Envato API to validate a purchase code.
<?php
// NOTE: verify-purchase has been deprecated and it's best to use the new /author/sale endpoint as documented on http://build.envato.com/
// created by Envato user wpdreams https://forums.envato.com/t/verify-purchase-class/3526
// usage example:
$o = EnvatoApi2::verifyPurchase( $purchase_code );