Can’t Connect to MySQL Database using WP CLI and MAMP on a macOS Catalina, using Oh My Zsh

Can’t Connect to MySQL Database using WP CLI and MAMP on a macOS Catalina, using Oh My Zsh

I’m running macOS Catalina and am trying to use WP CLI with MAMP, with iTerm2 and Oh My Zsh as my command line.

However in my localhost directory when I enter wp in the command line, and then press q to exit, I get the following errors:

PHP Notice:  Undefined index: SERVER_NAME in phar:///usr/local/Cellar/wp-cli/2.4.0/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1197) : eval()'d code on line 5  
Notice: Undefined index: SERVER_NAME in phar:///usr/local/Cellar/wp-cli/2.4.0/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1197) : eval()'d code on line 5
PHP Warning:  mysqli_real_connect(): (HY000/2002): No such file or directory in /Users/mattpjennings/Desktop/projects/mj/build/mj.net/wp-includes/wp-db.php on line 1626
Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in /Users/mattpjennings/Desktop/projects/mj/build/mj.net/wp-includes/wp-db.php on line 1626

Then when I enter wp plugin list I also get the error below:

Error: Error establishing a database connection.

When I enter wp --info I get:

PHP binary: /usr/local/Cellar/php/7.4.6/bin/php
php.ini used:   /usr/local/etc/php/7.4/php.ini

I already tried adding the line below to ~/.oh-my-zsh/custom/aliases.zsh to change the php or php.ini path when I enter wp --info:

#MAMP Madness export 
PATH=/Applications/MAMP/Library/bin:$PATH 
PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1` export 
PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH

I also tried changing the line below on the wp-config.php file, which didn’t work:

define('DB_HOST', '127.0.0.1:8889');

Any help would be appreciated. I really would like to use WP-CLI locally on my Mac.

Go to Source
Author: risingPhoenix1979

DNS DDOS Attack – would like to understand log

DNS DDOS Attack – would like to understand log

As part of a DOOS attack (largely inefectual) I am currently seeing log messages of the form:

<DATE> client <EXTERNAL-IP>#3074 (<NAME>): query: <SAME-NAME> IN RRSIG + (<ONE-OF-MY-IPs>)

My reading of the DNS log suggests that this is a query coming from < EXTERNAL-IP >, with the result to be sent to < ONE-OF-MY-IPs >. Is that correct?

We are running an older BIND, soon to be upgraded, but I was hoping to understand what this query is actually doing (many are sent).

Edit: Also, would be nice to know how they are able to structure it to send the result to another IP.

Go to Source
Author: RabidMutant

Jenkins Plugin:Extended Choice Parameter from JSON file

Jenkins Plugin:Extended Choice Parameter from JSON file

Extended Choice Parameter plugin query: How to load params dynamically from a JSON file for jenkins build job. Here is my jenkins script to add normal parameters and Extended Choice parameters as well.

p

roperties([
        [$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', numToKeepStr: '500']],
        parameters([extendedChoice( 
        defaultValue: 'One,Two,Three,Four', 
        description: '', 
        multiSelectDelimiter: ',', 
        name: 'SAMPLE_EXTENDED_CHOICE', 
        quoteValue: false, 
        saveJSONParameterToFile: false, 
        type: 'PT_CHECKBOX', 
        value:'One,Two,Three,Four,Five,Six,Seven,Eight,Nine,Ten', 
        visibleItemCount: 10)
        ])
])

This is working. But I want to be able to load parameters from a JSON file (using Extended Choice Parameter plugin). How can I modify the above script to accomplish that? PS: Here is the reference for Extended Parameter plugin. https://plugins.jenkins.io/extended-choice-parameter/

Go to Source
Author: Vineel

how to run Docker/Jenkins behind a proxy

how to run Docker/Jenkins behind a proxy

For the past few days I’ve been scratching my head trying to get the Jenkins docker image to work

The issue appears to be a proxy issue.

OS: Ubuntu 16.04 LTS

Running behind work proxy

Docker version 19.03.5, build 633a0ea838

Jenkins:https://hub.docker.com/_/jenkins/

When I run the following command, I can’t access jenkins on localhost:7000

docker run --name myjenkins -p 7000:8000 -p 50000:50000 -v /var/jenkins_home jenkins

However I can with the following command

docker run --name myjenkins -p 7000:8080 -p 50000:50000 --env HTTP_PROXY=“http:// localhost:8080” --env HTTPS_PROXY=“https:// localhost:8080” -v /var/jenkins_home jenkins

The issue is, with the second command, I can access the jenkins but I can’t install plugins and it asks me to configure the proxy
Setting the proxy in the UI didn’t work

My understanding is that Jenkins look for port 8080 by default and because in the command above I’m using port 7000, this is preventing Jenkins from connecting to the internet (correct me if I’m wrong)

So what I did was download the Dockerfile for Jenkins and changed the port from 8080 to 7000

Dockerfile

I am now attempting to build the image with the following command

docker build --tag jenkins:1.0 .

I get the following error

curl: (7) Failed to connect to github. com port 443: Connection timed out
The command ‘/bin/sh -c curl -fsSL https:// github. com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static-amd64 -o /bin/tini && chmod +x /bin/tini && echo “$TINI_SHA /bin/tini” | sha256sum -c -’ returned a non-zero code: 7

I suspect, this is a proxy issue and I did put proxy arguments in the Dockerfile but not sure if this is what I need to do or whether I’m doing it correctly

Any idea what could be the solution?

Thank you

Go to Source
Author: Sgr

Get file size from folder by filter

Get file size from folder by filter

I’m using vb.net.
I wanna ask how I can get the file size for each file by filter?
I wanna get all the size of .ts files

here’s the code I’m using

Dim TotalSize As Long = 0
Sub FileSize()
    Dim TheSize As Long = GetDirSize(txtPath.Text)

    TotalSize = 0 'Reset the counter

    If TheSize < 1024 Then
        lblSize.Text = Math.Round(TheSize, 0) & " B"
    ElseIf TheSize > 1024 AndAlso TheSize < (1024 ^ 2) Then
        lblSize.Text = Math.Round(TheSize / 1024, 1) & " KB"
    ElseIf TheSize > (1024 ^ 2) AndAlso TheSize < (1024 ^ 3) Then
        lblSize.Text = Math.Round(TheSize / 1024 / 1024, 1) & " MB"
    ElseIf TheSize > (1024 ^ 3) AndAlso TheSize < (1024 ^ 4) Then
        lblSize.Text = Math.Round(TheSize / 1024 / 1024 / 1024, 1) & " GB"
    End If
End Sub
Public Function GetDirSize(folder As String) As Long
    Dim FolderInfo = New DirectoryInfo(folder)
    For Each File In FolderInfo.GetFiles : TotalSize += File.Length
    Next
    For Each SubFolderInfo In FolderInfo.GetDirectories : GetDirSize(SubFolderInfo.FullName)
    Next
    Return TotalSize
End Function

Go to Source
Author: zackmark29

Boot Freezes and “Loading initial Ramdisk”

Boot Freezes and “Loading initial Ramdisk”

I upgraded from Ubuntu 19 to Ubuntu 20.04 yesterday and then on restart my Laptop (Alienware 17r4 , Nvidea GTX1070) freezez at “Loading initial Ramdisk”

i googled a lot and applied couple of workarounds but didnt help
– Adding nomodeset – Didnt help .
– Updated my Bios Firmware from Dell – Didnt help
– Updating grub2 – didnt help

The weird thing is that when i enable Secure Boot from Bios , it lets me Boot one time and then it does not let me boot upon restart . I again have disbale Secure boot , then when i boot i boot upto Login screen of Ubuntu but id does not let me pass through even after entering correct password and then when i enable secure boot it lets me boot Normally(very Slow)

i tried to Folloow : Ubuntu 18.04 fails to boot even in recovery mode (stuck on loading initial ram disk) on ASUS UX433FA
but i dont think the mentioned intel drivers are availaible for ubuntu 20.04

-i am using Nvidea Proprietary drivers (nvidea-driver-440)

Any help will be highly appreciated

Go to Source
Author: Yogesh Singh

Auto-mount disk at start-up on Fedora 32 Linux

Auto-mount disk at start-up on Fedora 32 Linux

I can’t get a disk to auto-mount at start-up since I upgraded to Fedora 32 (from Fedora 31, with clean install).

Although if I issue a sudo mount -a after boot, the disk mounts immediately.

I didn’t backup fstab prior to the upgrade.
The current fstab line I use for this disk (LVM2 volume) is

/dev/mapper/vgdata-data /home/data              ext4    nosuid,nodev,nofail,x-systemd.device-timeout=1ms 0 0

Note: the disk is encrypted with luks2 and decrypted at boot with crypttab.

What am I missing?

Go to Source
Author: macxpat

WordPress website hosted on nginx ubuntu isn’t loading anymore

WordPress website hosted on nginx ubuntu isn’t loading anymore

I just found out the WordPress website isn’t running anymore. When opening example.in, it simply shows the text Error establishing a database connection. The wp website is the folder /var/www/examplewp

I have other non-PHP based websites running smoothly on the same server. Even the xxx.example.in which is a non-php based website is working.

I tried opening files such as example.in/readmore.html or example.in/hello.txt which I created in the base folder of the WP and that’s working.

Here’s the details:

php -v

PHP 7.2.19-0ubuntu0.18.10.1 (cli) (built: Jun  4 2019 14:46:43) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.19-0ubuntu0.18.10.1, Copyright (c) 1999-2018, by Zend Technologies

uname -a

Linux ubuntu-s-1vcpu-1gb-blr1-01 4.18.0-25-generic #26-Ubuntu SMP Mon Jun 24 09:32:08 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

This is my xxx_nginx.conf file

server {
        server_name example.in www.example.in;
        root /var/www/examplewp;
        access_log /var/log/nginx/wp_client_access.log;
        error_log /var/log/nginx/wp_client_error.log;

        location / {
                index   index.php index.html;
                #try_files      $uri $uri/ /index.php?$args;
        }
        # Specify a charset
        charset                         utf-8;
        # GZIP
        gzip                            off;

        # Add trailing slash to */wp-admin requests.
        rewrite /wp-admin$ $scheme://$host$uri/ permanent;

        # Prevents hidden files (beginning with a period) from being served
        location ~ /. {
                access_log                      off;
                log_not_found                   off;
                deny                            all;
        }
        ###########
        # SEND EXPIRES HEADERS AND TURN OFF 404 LOGGING
        ###########

        location ~* ^.+.(xml|ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
                access_log                      off;
                log_not_found                   off;
                expires                         max;
        }

        # Pass all .php files onto a php-fpm or php-cgi server
        location ~ .php$ {
                try_files                       $uri =404;
                include                         /etc/nginx/fastcgi_params;
                fastcgi_read_timeout            3600s;
                fastcgi_buffer_size             128k;
                fastcgi_buffers                 4 128k;
                fastcgi_param                   SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_pass                    unix:/run/php/php7.2-fpm.sock;
                fastcgi_pass                    unix:/run/php/php7.2-fpm.sock;
                fastcgi_index                   index.php;
        }

        # ROBOTS

         location = /robots.txt {
               allow all;
               log_not_found off;
               access_log off;
        }
        # RESTRICTIONS
        location ~* /(?:uploads|files)/.*.php$ {
                deny all;
        }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/example.in/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.in/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}

server {
    if ($host = www.example.in) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = example.in) {
        return 301 https://$host$request_uri;
    } # managed by Certbot

        server_name example.in www.example.in;
    listen 80;
    return 404; # managed by Certbot
}

I tried restarting the server with sudo service nginx restart but it doesn’t help. Even the HTML or TXT files aren’t opening. I tried with the command line sudo service php7-fpm restart but got the response:

Failed to restart php7-fpm.service: Unit php7-fpm.service not found.

I can open info.php file though which has the phpinfo(); and see all the PHP related files.

I also check the error log but it’s empty: /var/log/nginx/wp_client_error.log

I tried restarting the mysql with this command land: sudo /etc/init.d/mysql start and got the following error:

[....] Starting mysql (via systemctl): mysql.serviceJob for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
 **failed!**

Go to Source
Author: Nikita Gupta

Double win10 installs – both bitlocker protected and isolated

Double win10 installs – both bitlocker protected and isolated

Hardware:

  • AMD Ryzen processor, ASUS Crosshair Hero VI mb, no TPM installed
  • M.2 Samsung 960 PRO SSD
  • SATA Samsung 840 PRO SSD

I would like to have latest win10 2004 on both SSDs and isolated from one another for privacy reasons.

  • 1st SSD is for work and part of AzureAD
  • 2nd SSD should be private

M.2 is already installed, with bitlocker and working. Asking for PIN on boot (before OS menu).

When I tried to setup bitlocker on 2nd SSD bitlocker setup crashed and cannot boot to 2nd OS anymore.
TrueCrypt is also an alternative for 2nd SSD, but seems I will have same problems with bootloaders?

Any suggestions how to set this up?
If really necessary I will reinstall everything.

Go to Source
Author: PeroR

What booking/appointments plugin can I use that supports multiple employees that are located in different timezones?

What booking/appointments plugin can I use that supports multiple employees that are located in different timezones?

I have a site I’m working on in WordPress for a multi-instructor live course/online lessons system.
I have been searching for booking calendar/appointment plugins and have not come across a single one that supports multiple staff/employees in different timezones. They all have the feature for customers to view the calendar in their own timezone, but don’t have the ability for a staff member to create a schedule for the week in their timezone.

For instance, let’s say Jerry lives in India. He wants to make his schedule for the week in Indian time since he lives in India. He adds availability Monday-Friday from 4pm (Indian time) – 8pm (Indian Time).

A student from the United States sees his profile and wants to book his class. The calendar on the customer end is displayed in Los Angeles, USA time and the student chooses an appointment that is available that Jerry set in Indian time. Does that make sense?

I haven’t found a single plugin that does this, and it’s extremely frustrating. My current timezone is Bangkok, and I want the site to stay in Bangkok timezone while each individual employee is able to set their own individual timezone depending on where they live.
I don’t want to have to build a timezone chart for each timezone possibility and have the employees adhere to Bangkok time and make mistakes on their availability and schedule due to bad math.

Can anyone help me? Where can I find a good plugin for this? Have I missed or overlooked something? Should I just use some 3rd party site for team scheduling and make the employee add the link to that site on their profile page? I’m kind of frustrated and lost at this point, and it’s very surprising to me that this feature isn’t included in the top, enterprise-level booking calendar plugins.

Go to Source
Author: Connor Smith

Maintaining Objects Across API Deployment Instances

Maintaining Objects Across API Deployment Instances

I am working on a web application as a hobby and trying to learn some concepts related to cloud development and distributed applications. I am currently targeting an AWS EC2 instance as a deployment environment, and while I don’t currently have plans to deploy the same instance of my API application to many servers, I would like to design my application so that is possible in the future.

I have a search operation that I currently have implemented using a Trie. I am thinking that it would be slow to rebuild the trie every time I need to perform the search operation, so I would like to keep it in memory and insert into it as the search domain grows. I know that if I only wanted to have one server, I could just implement the trie structure as a singleton and dependency inject it. If I do this in a potentially distributed application, though, I would be opening myself up to data consistency issues.
My thought was to implement the trie in another service and deploy it separately and make requests to it (this sounds like micro service concepts, but I have no experience with those). Is this common practice? Is there a better solution for maintaining persistent data structures in this way?

Go to Source
Author: jlat96

Use ACF Category Image for all Taxonomy Archive Views

Use ACF Category Image for all Taxonomy Archive Views

I’m wondering if you could help with some code I’m struggling with.

I’ve got an ACF Image Field on the Post Category Taxonomy. I need to add it into the post loop so the category image shows up instead of the featured image. Here’s the code that I have in:

$current_term = get_queried_object();
$author_image = get_field('author_image', $current_term );
echo do_shortcode('[image_shortcode id="'.$author_image.'" image_size="original"]'); 

It’s working on the Category Archive page, but not on the Tags Archive page. Let me know your thoughts.

Go to Source
Author: Jason

Change Font color and size when booting into CLI ubuntu 20.04 LTS

Change Font color and size when booting into CLI ubuntu 20.04 LTS

I was wondering if there was a way to increase font size and change font colour when booting into CLI.
The font is small and white on black, I want it to change the font colour.
If anyone can help, that would be great.
I am ready to provide any system details if needed.
Thanks

Go to Source
Author: Ammar