How do I change permissions for a folder and all of its subfolders and files in one step in Linux?

The other answers are correct, in that chmod -R 755 will set these permissions to all files and subfolders in the tree. But why on earth would you want to? It might make sense for the directories, but why set the execute bit on all the files?

I suspect what you really want to do is set the directories to 755 and either leave the files alone or set them to 644. For this, you can use the find command. For example:

To change all the directories to 755 (drwxr-xr-x):

sudo find /home/ubuntu/public_html -type d -exec chmod 755 {} \;

To change all the files to 644 (-rw-r--r--):

sudo find /home/ubuntu/public_html -type f -exec chmod 644 {} \;

How to Delete a Facebook Pixel from Business Manager

There is no way to delete an existing pixel. However, you can go to “Business Settings” > “Data Sources” > “Pixels” and there remove the connected “Ad Account” this way the pixel won’t show up in your list of pixels when creating ads or custom/lookalike audiences!

Soa Technology

Additionally, don’t forget to remove them from your website as well.

After contacting facebook support, I learned that it is not possible to delete your pixel from your account! This is outrageous indeed and does not make any sense! You can remove them from your site and this would stop data tracking and everything, except for your facebook account would have multiple Pixels that would make it look unorganized.

Email : adityaypi@yahoo.com, Mobile : +91-9555699081

filezilla not showing hidden files

FileZilla

Open the Filezilla FTP program.

  1. From the menu bar at the top of the screen select Server.
  2. Select Force showing hidden files.
  3. In the Remote Site panel on the right, you should now see all of your files including any hidden ones.

WinSCP

Open the WinSCP FTP program.

  1. From the menu bar at the top the screen select Options then Preferences.
  2. Select Panels from the left column.
  3. Tick to Show hidden files.
  4. In the panel on the right showing the remote site, you should now see all files including hidden ones.

That’s it! You now know how to show hidden files in FileZilla and WinSCP.

get key and value from GET in php

For some specific purposes you may want to know the current key of your array without going on a loop. In this case you could do the following:

reset($array);
echo key($array) . ' = ' . current($array);

The following functions are not very well known but can be pretty useful in very specific cases:

key($array);     //Returns current key
reset($array);   //Moves array pointer to first record
current($array); //Returns current value
next($array);    //Moves array pointer to next record and returns its value
prev($array);    //Moves array pointer to previous record and returns its value
end($array);     //Moves array pointer to last record and returns its value

OTHER EXAMPLE :

<?php foreach($array as $text => $url): ?>
    <a href="<?php echo $url; ?>"><?php echo $text; ?></a>
<?php endforeach; ?>


$array = array(
    'SOA' => 'http://soatechnology.net',
    'Delhijurix' => 'http://delhijurix.com'
);

foreach($array as $title => $url){
    echo '<a href="' . $url . '">' . $title . '</a>';
}

how to load otf fonts in html faster

Put Fonts on CDN

The .htaccess or httpd.conf Code

The code can be placed with the .htaccess file or httpd.conf file:

# Apache config
<FilesMatch ".(eot|ttf|otf|woff)">
	Header set Access-Control-Allow-Origin "*"
</FilesMatch>

# nginx config
if ($filename ~* ^.*?\.(eot)|(ttf)|(woff)$){
	add_header Access-Control-Allow-Origin *;
}

Use Non-Blocking CSS Loading

<link rel="stylesheet" type="text/css" href="fonts.css" media="none" onload="this.media='all';">
<link rel="stylesheet" type="text/css" href="style.css" media="none" onload="this.media='all';">

Essentially using media=none let’s the browser download the stylesheet without blocking rendering, so when the stylesheet has loaded, setting the media to its desired setting will then render the screen as it should. 

Separate Font Selectors

h1 { font-family: Arial, serif; } /* basic system font */
.fontsloaded h1 { font-family:  'MySpecialFont', serif; } /* custom system font */

<link href="fonts.css" onload="document.body.className+=' fontsloaded';" rel="stylesheet" type="text/css" >

Storing Fonts in localStorage

var md5 = 'e90ba95faca6e63b5516ed839f4514ec',
    key = 'fonts',
    cache;

function insertFont(value) {
  var style = document.createElement('style');
  style.innerHTML = value;
  document.head.appendChild(style);
}

// PRE-RENDER
try {
  cache = window.localStorage.getItem(key);
  if (cache) {
    cache = JSON.parse(cache);
    if (cache.md5 == md5) {
      insertFont(cache.value);
    } else {
      // Busting cache when md5 doesn't match
      window.localStorage.removeItem(key);
      cache = null;
    }
  }
} catch(e) {
  // Most likely LocalStorage disabled
  return
}

// POST-RENDER
if (!cache) {
  // Fonts not in LocalStorage or md5 did not match
  window.addEventListener('load', function() {
    var request = new XMLHttpRequest(),
        response;
    request.open('GET', '/path/to/fonts.json', true);
    request.onload = function() {
      if (this.status == 200) {
        try {
          response = JSON.parse(this.response);
          insertFont(response.value);
          window.localStorage.setItem(key, this.response);
        } catch(e) {
          // LocalStorage is probably full
        }
      }
    };
    request.send();
  });
}

how to load css before page load

Each network call takes one second. This is highly simplified points :

  • If we call the CSS file first, the browser will get the CSS in one second.
  • If we call the javascript first, the browser will get the CSS in two seconds (one second to retrieve the javascript + one second to retrieve the CSS).
  • If we call the javascript and the image before the CSS then the browser will get the CSS in three seconds.

This needed because the browser can not display anything at all until it first has the CSS.

Page content sequence:

  1. CSS
  2. IMG
  3. JS

Sexy css tricks for fade out hr css from left and right

This is a good example of how CSS3 should be used. To provide additional effects to users with modern browsers, without relying on graphics, and have solid fallback (in this case just a black 1px line, for users in non-css3 supporting browsers.

EXAMPLE 1:

div{
    margin-top:50px;
}
<style>
.sexy_line{ 
    display:block;
    border:none;
    color:white;
    height:1px;
    background:black;
    background: -webkit-gradient(radial, 50% 50%, 0, 50% 50%, 350, from(#000), to(#fff));
}
</style>

EXAMPLE 2:

<br><br><br>
<div class="fade_rule"></div>  
<br><br><br>
<div class="fade_rule"></div>  
<br><br><br>
<div class="fade_rule"></div> 

<style>
.fade_rule {
        height: 1px;
        background-color: #E6E6E6;
        width: 66.0em;
        margin: 0 auto;
        background-image: linear-gradient(left , white 2%, #E6E6E6 50%, white 98%);
        background-image: -o-linear-gradient(left , white 2%, #E6E6E6 50%, white 98%);
        background-image: -moz-linear-gradient(left , white 2%, #E6E6E6 50%, white 98%);
        background-image: -webkit-linear-gradient(left , white 2%, #E6E6E6 50%, white 98%);
        background-image: -ms-linear-gradient(left , white 2%, #E6E6E6 50%, white 98%);
        background-image: -webkit-gradient( linear, left bottom, right bottom, color-stop(0.02, white), color-stop(0.5, gray), color-stop(0.98, white) );
}
</style>

How to Disable Apport Error Reporting in Ubuntu

To disable error reporting on Ubuntu, run the following command to open the apport configuration file.

sudo nano /etc/default/apport

You will see a line enabled=1. To disable error reporting, change the value of enabled from 1 to 0.

Press CTRL+O to save the file. CTRL+X to exit out of the file. And you are done! You won’t see error pop up any more!

sudo systemctl disable apport

Or completely remove apport program from your system.

sudo apt purge apport

Enable Apport Error Reporting

If for any reason you want to enable the reporting service, run:

sudo apt install apport

sudo systemctl start apport

And then make sure the value of enabled is set to 1 in /etc/default/apport configuration file.

Check Error Reports Sent from Your Desktop Ubuntu System

Go to System Settings > security & Privacy > Diagnostics.Click Show Previous Reports.

Check Error Reports Sent from Your Ubuntu System – Directory path

/var/crash

system information disabled due to load higher than 1.0

The Message of the day (MOTD) in Ubuntu is controlled by the directory /etc/update-motd.d/ (and the file /etc/update-motd, if any). Particularly, the Landscape info resides in the file /etc/update-motd.d/50-landscape-sysinfo, as simpoir mentioned in their answer.

On my Ubuntu 16.04, the file /etc/update-motd.d/50-landscape-sysinfo contains some entry settings and then an if block. So to display the information regardless of the condition, you can simply remove all contents except shebang and the if block contents. The result on my Ubuntu 16.04:

#!/bin/sh
echo
echo -n "  System information as of "
/bin/date
echo
/usr/bin/landscape-sysinfo

To do this, use the following procedure in the terminal:

cd /etc/update-motd.d                 # go to the right directory
sudo cp -L 50-landscape-sysinfo{,.bak}  # keep a backup copy: 50-landscape-sysinfo.bak
sudo nano 50-landscape-sysinfo        # edit the file contents using 'nano'
                                      # (or your favorite text editor)
                                      # and paste the above contents to it

What is meant by load higher than 1.0?

The load tells how much the hardware resources of your computer are being requested currently. As a rule of thumb, if it’s higher than your computer’s processor (core) count, the tasks get delayed. It’s OK to get the high-load MOTD message just after boot but if it keeps appearing for several days (MOTD may update just once a day), check whether your machine is powerful enough for the tasks it’s performing.

How to add/remove other commands to be run at cli login?

There are multiple ways and the right way depends on the purpose. You could simply add a script to the directory /etc/update-motd.d/ but it would be only run when the MOTD is updated.