Skip to content

Instantly share code, notes, and snippets.

@jmcausing
jmcausing / gist:fa8d4db905b2b5468300987fa5184f4e
Created October 8, 2019 09:15
SIGSEGV / 502 or 503 bad gateway solution
"get ID of the php fpm
ps -faux | grep -I $(pwd | awk -F/ '{print $4}' | cut -c -7 ) | grep php-fpm
get the ID of the php fpm child
make sure to login as root: btool su
strace command:
strace -s 1024 -P CHILD_ID -e trace=file
@jmcausing
jmcausing / gist:7358bdff1b961a78098a3e5b791882db
Created October 8, 2019 09:16
Cannot update upstream merged conflict. Error from git pull -Xtheirs git://github.com/pantheon-systems/WordPress.git master:
"Let’s try these steps from your local environment.
1.) Backup the wp-content folder (save it somewhere). Then delete folder that folder.
2.) Reset the site code base (undo commit) to the last applied core updates / successfully update (you can find the commit hash / find something update to Wordpress in the site dashboard -> dev site. -> code). If doesn’t work, find the next successful core updates. See. This guide on how undo commits: https://pantheon.io/docs/undo-commits/ <—
Example:
git reset --hard d2043a0e
d2043a0e is the commit where I was able to update WordPress core in the past.
3.) git pull -Xtheirs git://github.com/pantheon-systems/WordPress.git master
4.) Restore the wp-content folder
5.) git push origin master
@jmcausing
jmcausing / gist:15cc506170438bed139eafdf62445ddb
Created May 6, 2020 01:47
Dynamic WP shortcodes from each post - custom post type
// Load causing_forms_query() function after WP loads.
add_action( 'init', 'causing_forms_query' );
function causing_forms_query() {
add_shortcode('cforms', 'cforms_scode');
}
function cforms_scode( $attr, $content="") {
add_action( 'init', 'start_logging' );
function start_logging() {
// GET IP
if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) {
//check ip from share internet
$ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
if ( wp_doing_ajax() )
{
echo "admin-ajax.php is here...<br>";
// Check which action is using that ajax..
$ajax_action = $_REQUEST['action'];
echo "It is calling this action: <br>" . $ajax_action . "<br>";
[
{
"ajax_action": "loadmore",
"timestamp": 1590312858
},
{
"ajax_action": "loadmore",
"timestamp": 1590312867
},
{
/// This is your ajax handler called to generate contents file
function wcg_start_generate_function() {
// Retrieve data from ajax
if( isset( $_POST[ "post_type" ] ) ) {
$post_type = $_POST[ "post_type" ];
$quantity = $_POST[ "post_qty" ];
jQuery(document).ready(function ($) {
// Create contents -- START
$( ".wcg_submit" ).click(function() {
post_type = jQuery('select.wgc_post_type').val();
qty = jQuery('.wcg_count').val();
data = {
"action": "wcg_start_generate",
vagrant@causingdesigns:~/trellis$ ansible-playbook deploy.yml -e env=staging -e site=staging-rosellejoycausing.kinsta.cloud --limit=kinsta_staging
/usr/local/lib/python2.7/dist-packages/cryptography/__init__.py:39: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now deprecated in cryptography, and will be removed in a future release.
CryptographyDeprecationWarning,
PLAY [Ensure necessary variables are defined] *******************************************************************************************************************************
[WARNING]: Failure using method (v2_playbook_on_play_start) in callback plugin
(<ansible.plugins.callback./home/vagrant/trellis/lib/trellis/plugins/callback/vars.CallbackModule object at 0x7f891b69c990>): 'AnsibleUnicode' object has no attribute
'get_groups'
skipping: no hosts matched
@jmcausing
jmcausing / gist:b0f9d5132e5b35bcae7266367eaae969
Created December 25, 2022 01:07
Serial port 1 (console)
Serial port 1 (console) output for instance-1-eng-2819
[=3h[=3hCSM BBS Table full.
BdsDxe: loading Boot0003 "ubuntu" from HD(15,GPT,75740168-3E29-49A1-B76C-768ECDE1FF97,0x2800,0x35000)/\EFI\ubuntu\shimx64.efi
BdsDxe: starting Boot0003 "ubuntu" from HD(15,GPT,75740168-3E29-49A1-B76C-768ECDE1FF97,0x2800,0x35000)/\EFI\ubuntu\shimx64.efi
UEFI: Attempting to start image.
Description: ubuntu
FilePath: HD(15,GPT,75740168-3E29-49A1-B76C-768ECDE1FF97,0x2800,0x35000)/\EFI\ubuntu\shimx64.efi
OptionNumber: 3.