Snippets.page

Code snippets, tips, how-tos

Author: Veesar

  • Install Tailscale on WSL2

    Install Tailscale on WSL2

    Tailscale is your own personal VPN that opens up a lot of possibilities. A private VPN gives you access to all your devices even when you’re not connected to the same local network. Tailscale gives your device a “static” IP that you can use to connect to it from anywhere. This lets you set up […]

    Read more

  • Fix OneNote’s Quick Notes sync

    Fix Quick Notes sync across Windows, Android and iOS. One reason for sync issues is because OneNote uses different default locations for the Quick Notes section on different platforms. The default Quick Notes in desktop creates and uses a notebook which is stored in UserProfile/Documents/OneNote Notebooks. This notebook may not be synced to your Microsoft […]

    Read more

  • Change the footer in WordPress admin

    To change the footer text in the WordPress admin area, add the following lines to your theme’s functions.php. To remove the version number on the right side of the footer, you need to remove the existing text and then add the new text.

    Read more

  • Run multiple versions of PHP in XAMPP

    Download the required version of PHP from https://www.php.net/downloads.php. For PHP7+, you can download the Thread Safe version. For older PHP, try the Non Thread Safe version. Create another folder in C:\xampp for this version of PHP apart from the existing C:\xampp\php. E.g., C:\xampp\php74. Copy the downloaded version’s files into this folder Create php.ini in this […]

    Read more

  • Redirect Subfolder to Subdomain using .htaccess

    Setup redirection after migrating a site from a subfolder to a subdomain. When a site in a subfolder is moved to a subdomain, .htaccess rules need to updated to redirect URLs. This can be done by adding the following lines to the .htaccess file in the root folder: This will redirect all calls to domain.com/subfolder/* […]

    Read more

  • Overflow both sides in CSS

    Normally, when content or an image overflows outside a div, the overflowing content is shown on the right outside the “box”. If you want to position the content to the center, so that overflow is on both sides, you can use this class. This is useful to position an image such that the centre of […]

    Read more

  • Make an inner div full width in CSS

    Make an inner div expand to the full-width of the page. When a div is inside another div, adding width: 100% will only stretch it to the width of its container. To make the stretch to the full width of the page (or viewport), use this:

    Read more

  • Add custom post types to WordPress search

    Include custom post types in the search using WordPress hooks To include custom post types in the default search, we need to modify the search function using an action hook. Post types that we want to search through are added to the search query in an array. The array needs to include WordPress’s default post […]

    Read more

  • Check disk usage in Linux command line

    View total disk usage Disk free space can be checked in the Linux command line using the df and du commands. df stands for disk free. du stands for disk usage. The -h flag stands for human. It shows the sizes in human readable formats like MB or GB instead of bytes. Disk usage by […]

    Read more

  • MySQL user management from the command line

    List or delete users from the command line. MySQL stores the list of users in the mysql.user table. List of all databases are available in the mysql.db table. Show list of MySQL users Show list of databases for a user Delete a user

    Read more