Skip to content

Instantly share code, notes, and snippets.

@goranseric
goranseric / server_certificates_to_pem.md
Created April 23, 2018 05:01 — forked from stevenhaddox/server_certificates_to_pem.md
Convert .crt & .key files into .pem file for HTTParty

Two ways to do it, but only worked for me so I'll put it first and the second for reference:

$ openssl pkcs12 -export -in hostname.crt -inkey hsotname.key -out hostname.p12
$ openssl pkcs12 -in hostname.p12 -nodes -out hostname.pem

Other options for this method in comments below:

# Note, the -certfile root.crt appends all CA certs to the export, I've never needed these so it's optional for my personal steps
$ openssl pkcs12 -export -in hostname.crt -inkey hsotname.key -certfile root.crt -out hostname.p12

Note, I've always had my hostname.crt as part of my .pem, so I keep my certs but apparently you may not have to, hence the nocerts flag being an extra option in this sample

@pento
pento / rainbow-bar.php
Last active September 26, 2017 21:20
WordPress Rainbow Bar
<?php
/*
* Plugin Name: Rainbow Bar!
*/
function rainbow_bar() {
?>
<style type="text/css">
#wpadminbar {
@butlerblog
butlerblog / functions.php
Last active March 28, 2024 02:09
SMTP using wp-config.php for settings #smtp #wp_mail
<?php // Don't use this line.
/*
* Add the script below to wherever you store custom code snippets
* in your site, whether that's your child theme's functions.php,
* a custom plugin file, or through a code snippet plugin.
*/
/**
* This function will connect wp_mail to your authenticated
@luckydev
luckydev / gist:b2a6ebe793aeacf50ff15331fb3b519d
Last active October 22, 2022 14:03
Increate max no of open files limit in Ubuntu 16.04/18.04 for Nginx
# maximum capability of system
user@ubuntu:~$ cat /proc/sys/fs/file-max
708444
# available limit
user@ubuntu:~$ ulimit -n
1024
# To increase the available limit to say 200000
user@ubuntu:~$ sudo vim /etc/sysctl.conf
@kheast
kheast / cpanel_ssl_install.py
Last active April 12, 2018 09:24
Python script to install SSL certificate from Let's Encrypt into Cpanel for a single domain.
#!/usr/bin/env python2.7
'''This script will install an SSL certificate into Cpanel
for a single domain. In my case, the certificate is from
Let's Encrypt via 'acme.sh'. The script expects the certificate
to be stored in the manner described at
http://east.fm/posts/acme-cpanel-a2hosting
This script requires a single argument: the domain name.
@butlerblog
butlerblog / filter_wp_mail_to_addr.php
Last active July 19, 2021 17:29
Change the #wp_mail "to" address based on subject
<?php
/**
* This is a filter for wp_mail(). It checks the subject
* for the presence of a given string (in this case "New
* User Registration"), and if that returns true it
* sets the "to" address/value.
*/
add_filter( 'wp_mail', 'my_wp_mail_filter' );
function my_wp_mail_filter( $args ) {
<?php
/*
Plugin Name: Wordpress Hostname Migration
Plugin URI: http://doublesharp.com/
Description: Functionality to ease in migration of Wordpress code and databases between environments.
Author: Justin Silver
Version: 1.0
Author URI: http://doublesharp.com
License: GPL2
*/
@LeonardoGandini
LeonardoGandini / wpdwna.sh
Last active September 8, 2023 08:17
Automate WordPress and wp-config.php creation
# Download Latest Wordpress archive from WP org
wget https://wordpress.org/latest.tar.gz
#Extract the archive showing the progress
pv latest.tar.gz | tar xzf - -C .
#Copy the content of WP Salts page
WPSalts=$(wget https://api.wordpress.org/secret-key/1.1/salt/ -q -O -)
#generate a random string; lower and upper case letters + numbers; maximun 9 characters
@mattyrob
mattyrob / wp-privacy.php
Last active July 30, 2023 19:00
Stop WordPress auto-updates and control information shared with api.wordpress.org
<?php
// you'll have to put a plugin header here
// Stop auto updated in WordPress 3.7+
add_filter( 'auto_update_core', '__return_false' );
add_filter( 'auto_update_plugin', '__return_false' );
add_filter( 'auto_update_theme', '__return_false' );
add_filter( 'auto_update_translation', '__return_false' );
// stop translation updates when updating plugins or themes
@danielbachhuber
danielbachhuber / correct-cookie-domain.php
Last active August 31, 2020 16:45
Correct the cookie domain when a custom domain is mapped to the site.