Skip to content

Instantly share code, notes, and snippets.

@codex73
codex73 / gist:709f3bc5b16c3baf0ee2fd330db21664
Created March 10, 2021 02:24
PHP, EXEC(), WKHTMLTOPDF, CMD LINE: How to use exec() command in PHP to generate pdf by pointing to a html page
// THE BELOW WORKS FOR LOCAL WINDOWS MACHINE FROM A WAMP HOSTED CODEIGNITER SITE - CALL MADE FROM CODEIGNITER CONTROLLER
$myCmd = "C://wamp//bin//wkhtmltopdf//wkhtmltopdf.exe http://proofofconcept.proximitystage.com/email-media-queries C://Users//mosley.j//Desktop//jonnny.pdf";
$result = exec($myCmd,$output,$var);
var_dump($output);
var_dump($var);
// BELOW IS THE CMD LINE CODE/STEPS YOU NEED IN ORDER TO RUN THE SAME THING FROM PURE CMD LINE
/**
* A bookmarklet for viewing the largest contentful paint in a page.
* Will show each LCP after the bookmarklet is clicked.
*
* To install:
* 1. Copy the code starting from the line beginning `javascript:`
* 2. Add a new bookmark in Chrome, and paste the code in as the URL.
**/
javascript:(function(){
try {
@jonom
jonom / DownloadCloudwaysLocalBackups.sh
Created October 4, 2019 03:30
CloudWays - bash script to download local backups for all applications on a server
#!/bin/bash
# CloudWays - Download local backups for all applications
# =======================================================
# * Local backups must be enabled and available. See https://support.cloudways.com/how-to-download-a-full-backup/
# * Add your machine's SSH key to your server so this script needs no input.
# * Backups will be saved inside a new folder with today's date within your nominated backup directory. (This might not be the date the backup was taken.)
# * Only tested on Digital Ocean VPS so far.
# Configuration
@imuhammadshoaib
imuhammadshoaib / class-wp-bootstrap-navwalker.php
Last active June 3, 2024 08:29
Make parent link clickable in Bootstrap with Wordpress NavWalker
//FROM
$atts['href'] = '#';
$atts['data-toggle'] = 'dropdown';
$atts['aria-haspopup'] = 'true';
$atts['aria-expanded'] = 'false';
$atts['class'] = 'dropdown-toggle nav-link';
$atts['id'] = 'menu-item-dropdown-' . $item->ID;
//TO
@eneko
eneko / list-of-curl-options.txt
Last active September 14, 2024 06:59
List of `curl` options
$ curl --help
Usage: curl [options...] <url>
--abstract-unix-socket <path> Connect via abstract Unix domain socket
--alt-svc <file name> Enable alt-svc with this cache file
--anyauth Pick any authentication method
-a, --append Append to target file when uploading
--basic Use HTTP Basic Authentication
--cacert <file> CA certificate to verify peer against
--capath <dir> CA directory to verify peer against
-E, --cert <certificate[:password]> Client certificate file and password
@philgyford
philgyford / .gitignore
Last active March 1, 2023 09:18
A script for importing images, and data about them in a CSV file, into WordPress
images/*
*.csv
@kmddevdani
kmddevdani / createChroot.sh
Created October 5, 2017 00:17
Creates chrooted user with real scp and ssh access on a amazon linux ec2 instance
#!/bin/bash
#
# This script creates a chrooted user, scp enabled, on an Amazon Linux aws instance
#
# 2017-10-05
#
# change username and password here:
username="abc"
@hemusyl
hemusyl / breadcrumbs-custom.php
Last active June 29, 2024 21:32
WordPress custom breadcrumbs without plugin
http://www.qualitytuts.com/wordpress-custom-breadcrumbs-without-plugin/
Step 1
Breadcrumbs are the important part of our website, in wordpress there are several plugins are available for this, but below i posted
the code for custom breadcrumbs for our wordpress site. Just add this below code in to your current wordpress theme functions.php
and call the second step.
<?php
function qt_custom_breadcrumbs() {
@amboutwe
amboutwe / yoast_seo_breadcrumb_remove_link.php
Last active August 8, 2024 18:25
These snippets are examples of how you can modify the Yoast SEO breadcrumb visual output. These snippets will not alter the breadcrumb schema output. Please consult the schema documentation to change the breadcrumb schema: https://developer.yoast.com/features/schema/api#to-add-or-remove-graph-pieces
@rchrd2
rchrd2 / test-php-basic-auth.php
Last active February 1, 2024 21:18 — forked from westonruter/test-php-basic-auth.php
PHP basic auth example
<?php
function require_auth() {
$AUTH_USER = 'admin';
$AUTH_PASS = 'admin';
header('Cache-Control: no-cache, must-revalidate, max-age=0');
$has_supplied_credentials = !(empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['PHP_AUTH_PW']));
$is_not_authenticated = (
!$has_supplied_credentials ||
$_SERVER['PHP_AUTH_USER'] != $AUTH_USER ||
$_SERVER['PHP_AUTH_PW'] != $AUTH_PASS