Category: Howto

Adding Speed Test and a Dark Theme to Pi-Hole Ad Blocker

Just keeping these notes here for anyone else that might find them useful.

First, install Pi-Hole as per regular.

Then, You’ll want to get the Dark Theme going with pi-hole.

  1. Open a terminal (or SSH if you’re remoting in) ( Ctrl + Alt + T )
  2. Type: cd /var/www/html/
  3. Type: sudo wget https://raw.githubusercontent.com/lkd70/PiHole-Dark/master/install.sh
  4. Type: sudo chmod +x install.sh
  5. Type: sudo ./install.sh
  6. Follow the onscreen instructions!

Then, verify it is working (you might have to clear cache) and that you see the dark theme.

Now you can install the Speed Test Module for Pi-Hole.

sudo apt install python-pip

sudo pip install speedtest-cli

sudo apt install sqlite3

#Configure correct timezone for graph *Need for graph to work correctly

sudo dpkg-reconfigure tzdata

#select your timezone

Find php version 

if it is 5.x

if it is 7.x

Restart Pi

You can try run it using

If Everything is ok, proceed to next step

Get the new set of admin Code from github ( New method  or try old one here)

 

Then do this to test your installation, and then reload the Pi-Hole interface.

You should be good to go! Let me know in the comments if you’re not.

SED lines to remove Bold customer pricing app from Shopify Theme

The Bold Customer Pricing app for Shopify is a little complex to remove.

You can follow the installation instructions in reverse for removal but you’ll probably also need these lines below to quickly find and replace the lines it has modified in your theme.

The other edits can’t really be automated with ease as each theme is different, but, these should remain the same.

If you’re on Mac, you’ll need to do this first in your terminal.

export LC_CTYPE=C 
export LANG=C

Then, go to the directory with your theme downloaded, probably using the themekit if you’re a regular developer, and execute these commands which will find and replace all instances of bold’s code.

find ./ -type f -exec sed -i -e 's/bold_price/product.price/g' {} \;
find ./ -type f -exec sed -i -e 's/bold_price_min/product.price_min/g' {} \;
find ./ -type f -exec sed -i -e 's/bold_price_max/product.price_max/g' {} \;
find ./ -type f -exec sed -i -e 's/bold_price_varies/product.price_varies/g' {} \;
find ./ -type f -exec sed -i -e 's/bold_compare_at_price/product.compare_at_price/g' {} \;
find ./ -type f -exec sed -i -e 's/bold_compare_at_price_min/product.compare_at_price_min/g' {} \;
find ./ -type f -exec sed -i -e 's/bold_compare_at_price_max/product.compare_at_price_max/g' {} \;
find ./ -type f -exec sed -i -e 's/bold_compare_at_price_varies/product.compare_at_price_varies/g' {} \;
find ./ -type f -exec sed -i -e 's/bold_selected_or_first_available_variant/product.selected_or_first_available_variant/g' {} \;
find ./ -type f -exec sed -i -e 's/bold_selected_or_first_available_variant/product.variants.first/g' {} \;
find ./ -type f -exec sed -i -e 's/bold_selected_or_first_available_variant/product.variants[0]/g' {} \;

Then just make sure you’ve done all the changes mentioned in their installation instructions (in reverse!) and you should be good to go.

Hope this helps someone else too!

Howto add the Slick Slider to Shopify on the Home Page.

So, you’re probably here because you want to implement the slick slider on your Shopify site without using an expensive app, or, enabling it sitewide.

This quick tutorial will get you started with enabling the slick slider on your theme, on just one page (in this case, the home page). We’re only going to load the libraries required, if required, which will keep the other pages nice and fast.

First I would create a backup of your Shopify theme, and then work on it. This way you have a backup should you fuck things up.

** Note – this slider is setup for 150×80 size images. You’re pretty much for sure going to have to edit the CSS anyway, but at the bare minimum you’ll have to change those dimensions if you want different image sizes. We’re using this as a vendor/brand slider so this size is perfect.

  1. First you’re going to want to go here, and download the latest copy of the Slick library.

    http://kenwheeler.github.io/slick/

  2. Now extract the files somewhere.
  3. Now login to your Shopify Store.
  4. Go to Online Store -> Themes -> Edit HTML/CSS
  5. Now you will want to scroll down to Assets.
  6. Click Upload Asset and find your extract files, and upload these one at a time.
    slick.min.js
    slick.css
    slick-theme.css 
    fonts/slick.woff
    fonts/slick.ttf
    fonts/slick.svg
    fonts/slick.eot
  7. Modify slick-theme.css and change the font path (remove ./font/)
    src: url('./fonts/slick.eot');

    Now becomes

    src: url('./slick.eot');
  8. Open up theme.liquid and in the header section (between <head> and </head>) paste the following code
    {% if template == 'index' %}
    {% if settings.home_vendor_carousel_enable %} 
    {{ 'slick.css' | asset_url | stylesheet_tag }}
    {{ 'slick-theme.css' | asset_url | stylesheet_tag }}
    {% endif %}
    {% endif %}
  9. Now scroll down to the bottom, and right before the closing body (</body>) paste the following code
    {% if template == 'index' %}
    {% if settings.home_vendor_carousel_enable %} 
    <!-- <script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
    <script type="text/javascript" src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script> -->
    {{ 'slick.min.js' | asset_url | script_tag }}
     <script type="text/javascript">
     $(document).ready(function() {
     $('.autoplay').slick({
     dots: false,
     infinite: true,
     speed: 500,
     slidesToShow: 5,
     slidesToScroll: 1,
     autoplay: true,
     autoplaySpeed: 2000,
     arrows: false,
     variableWidth: true
     });
     });
     </script>
    {% endif %}
    {% endif %}

    ** NOTE – we have the jquery, and jquery migrate library commented out because our theme already has it. If yours does not, you will need to uncomment the two two lines.

  10. Now, scroll up to where you want your slider and paste this code
    {% if settings.home_vendor_carousel_enable %}
    <center><h2>{{ settings.home_vendor_carousel_title }}</h2></center>
    <div class="slider-container">
     <div class="slider autoplay slider-custom">
     {% for i in (1..12) %}
     {% capture vendor %}home_vendor_enable_{{i}}{% endcapture %}
     {% capture vendor_name %}home_vendor_name_{{i}}{% endcapture %}
     {% capture vendor_logo %}vendor_logo_{{i}}.png{% endcapture %}
     {% if settings[vendor] %}
     <div>
     <a href="{{ settings[vendor_name] }}" title="{{ settings[vendor_name] }}">
     {{ vendor_logo | asset_url | img_tag: settings[vendor_name], "replace-2x img-responsive" }}
     </a>
     </div>
     {% endif %}
     {% endfor %}
     </div>
    </div> 
     <hr>
    {% endif %}
  11. Then paste this to the bottom of slick-theme.css, and edit anything you need to.
    .slider-container {
    position: relative;
    margin-top: 10px;
    left: 0;
    height: 100%;
    width:100%;
    }
    
    .slider-custom {
     width: 850px;
     margin-left: auto;
     margin-right: auto;
     display: block;
     height: 80px;
    }
    
    .slick-slide {
     width: 170px;
     padding-left: 10px;
     padding-right: 10px;
    }
  12. Now for the final change. Go back to your shopify admin interface, then to online store -> themes -> customize theme
  13. Scroll down to the config section
  14. Open up your copy of ‘settings_schema.json’
  15. Look for somewhere that makes sense (for us, we chose on the ‘home page’ section) and paste in the following keys / values
    {
     "type": "header",
     "content": "Vendor Logo Carousel"
     },
     {
     "type": "text",
     "id": "home_vendor_carousel_title",
     "label": "Vendor Carousel Title"
     },
     {
     "type": "checkbox",
     "id": "home_vendor_carousel_enable",
     "label": "Enable Vendor Carousel"
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_1",
     "label": "Enable Vendor 1"
     },
     {
     "type": "text",
     "id": "home_vendor_name_1",
     "label": "Vendor link 1"
     },
     {
     "type": "image",
     "id": "vendor_logo_1.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_2",
     "label": "Enable Vendor 2"
     },
     {
     "type": "text",
     "id": "home_vendor_name_2",
     "label": "Vendor link 2"
     },
     {
     "type": "image",
     "id": "vendor_logo_2.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_3",
     "label": "Enable Vendor 3"
     },
     {
     "type": "text",
     "id": "home_vendor_name_3",
     "label": "Vendor link 3"
     },
     {
     "type": "image",
     "id": "vendor_logo_3.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_4",
     "label": "Enable Vendor 4"
     },
     {
     "type": "text",
     "id": "home_vendor_name_4",
     "label": "Vendor link 4"
     },
     {
     "type": "image",
     "id": "vendor_logo_4.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_5",
     "label": "Enable Vendor 5"
     },
     {
     "type": "text",
     "id": "home_vendor_name_5",
     "label": "Vendor link 5"
     },
     {
     "type": "image",
     "id": "vendor_logo_5.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_6",
     "label": "Enable Vendor 6"
     },
     {
     "type": "text",
     "id": "home_vendor_name_6",
     "label": "Vendor link 6"
     },
     {
     "type": "image",
     "id": "vendor_logo_6.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_7",
     "label": "Enable Vendor 7"
     },
     {
     "type": "text",
     "id": "home_vendor_name_7",
     "label": "Vendor link 7"
     },
     {
     "type": "image",
     "id": "vendor_logo_7.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_8",
     "label": "Enable Vendor 8"
     },
     {
     "type": "text",
     "id": "home_vendor_name_8",
     "label": "Vendor link 8"
     },
     {
     "type": "image",
     "id": "vendor_logo_8.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_9",
     "label": "Enable Vendor 9"
     },
     {
     "type": "text",
     "id": "home_vendor_name_9",
     "label": "Vendor link 9"
     },
     {
     "type": "image",
     "id": "vendor_logo_9.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_10",
     "label": "Enable Vendor 10"
     },
     {
     "type": "text",
     "id": "home_vendor_name_10",
     "label": "Vendor link 10"
     },
     {
     "type": "image",
     "id": "vendor_logo_10.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_11",
     "label": "Enable Vendor 11"
     },
     {
     "type": "text",
     "id": "home_vendor_name_11",
     "label": "Vendor link 11"
     },
     {
     "type": "image",
     "id": "vendor_logo_11.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     },
     {
     "type": "checkbox",
     "id": "home_vendor_enable_12",
     "label": "Enable Vendor 12"
     },
     {
     "type": "text",
     "id": "home_vendor_name_12",
     "label": "Vendor link 12"
     },
     {
     "type": "image",
     "id": "vendor_logo_12.png",
     "label": "Icon",
     "max-width": 1000,
     "max-height": 563
     }
  16. Now save the file.
  17. Now open your customize theme (online store -> themes -> customize theme) and go to where you setup the vendor slider.
  18. Add your images to the slider and the title / etc.
  19. Click save
  20. If you did everything right, you should see the slider now, probably needing some CSS work to position it properly.

Hope this helps someone else looking to add a custom slider to their shopify theme, while not adding it sitewide.