Skip to main content

Blocklist-Update.sh

Blocklist-Update.sh is a script that I wrote to manage blocklists from bluetack etc to be used in conjunction with Transmission torrent downloader in Linux/MacOS. The script can be taylored to work with Qbittorrent as well, but the placement of the blocklists means you'd have to redirect the blocklist to go somewhere locally manageable as Transmission uses its own blocklist directory in .config. I believe there are about 10 lists there now. It works well for my needs. It can be ran weekly using crontab in standard user profile.  To download:  blocklist-update.sh To download the others:  Github

BASH SCRIPTING TUTORIAL #2: DECLARING VARIABLES

When writing scripts, it is often important to use and declare variables. Declaring variables is super easy. There are multiple ways to declare them, but they each work the same way. One way that I often employ is to prompt users for their input, place said input in a variable, and then use the variable to tell the script what the user wants. By this method, I am using the variable as a wrapper for something else. Variables are great for projects in coding where you really don’t know what the output of the variable will be, but you know what you want the variable to do. Other commands can be used as value for variables and declaring a word or a number as a variable and giving it value allows the echo command to print that value to the screen when typing echo $variable. A good example of declaring and calling a variable would be opening a terminal and typing var1=$(cat filename | grep “RandomPattern”) then typing echo $var1. Typing echo with the variable name will result in the value of that variable being displayed. Filename is just an example as we didn’t actually call an actual file with anything inside it. Grep would have looked for the specified pattern in quotes and that would have been the value. Another example would be:

num1=1

echo $num1

My output in this scenario would be the number one. Variables are often the first thing you learn in programming classes as these are used throughout whatever project you are trying to accomplish. While scripting languages are different from Java and or C, the idea is roughly the same. Across environments, these variables are declared and used in roughly the same ways. Python to Bash to Ruby, they all use them. A final example will be an excerpt from one of my own personal scripts.

echo "Enter the name of any software you'd like to install"
read software

This example relies on the user to give input and then uses the read command to register that input as the value of the variable known as software. When the command continues it would run similar to this:

sudo pacman -S –noconfirm $software

Where the above command would install all software specified and stored in $software. Variables can encompass values that are classified as Integers, Strings and booleans. Booleans can be either True or False for the value. Unlike other variable types, these variables are best suited for a case where the outcome of a scenario is uncertain. The previous examples were of integer and string value respectively, but now it is time to see a True/False boolean variable in action. An example of a boolean variable would be this:

while True; do
some command
break
done

Another form of this would be:

find /etc/hosts.bak
while [ $? -gt 0 ];
do
sudo cp /etc/hosts /etc/hosts.bak
break
done

This form looks for the file /etc/hosts.bak. If the file is not found, in this case, if the scenario is false it will continue to create the file and then break out of the loop. If the value were True or “0”, It would have simply returned the file name in question. We will get further into this and While loops at a later time.

Comments

Popular posts from this blog

NOSCRIPT CONFIGURATION FOR PALE MOON SPECIFICALLY

I wrote an article before about making Pale Moon more private. I covered a few of the settings and back end changes I make each time I install it. I mentioned Noscript, but I didn’t give any details about how I set it up. First though, you have to get the version already marked for your version of “Firefox” or in this case, Pale Moon. If you went to https://addons.palemoon.org/addon/noscript/ you would probably find the Pale Moon addons page devoted to the newest possible Noscript being marked specifically for Pale Moon. Other versions may work, but these are hybrid addons and the closer we get to Noscript 10, the less I trust it to work with Pale Moon specifically. I just opt to stick with 5.0.6. There have been people asking about what happens when Maone, the developer stops supporting the hybrid versions of Noscript, “Will it work with Pale Moon?” Why yes it will. Noscript blocks scripts, that’s its main function and it will do that as long as Java script exists on a page.

SSD PARTITION ALIGNMENT

I was searching for more information regarding SSDs last night as that is what I now use, I found an interesting little tip that most users will never have to worry about, but people using Arch Linux, Manjaro or Windows that was cloned from another drive may want to consider checking this. The Partition manager within Linux normally takes good care to ensure that you have some free space to be used by the SSD in the event that a cell becomes worn out or corrupted. Also, Linux generally ensures that a proper amount of unallocated drive space is set aside preceeding the partition. However, on my own image of Manjaro, I discovered that this was not the case. The partition was “out of alignment”. To fix this situation, I found an article on  Lifehacker that went into instructional detail about how to solve this from a live environment or an image of Gparted . Gparted is a separate live environment of Linux that is based on Debian and uses Gparted as the main tool to manage par

PALE MOON PRIVACY SETUP

I did a review of Pale Moon back when 27.6.2 came out in linux. I had mostly great things to say about the browser then and my feelings towards it have not changed. Pale Moon is a very useful tool for scowering the net. It has privacy at its core with a few implementations made by Moonchild, the lead developer, built in. I also mentioned the point that Pale Moon has a canvas poisoning feature in the backend, however, I wasn’t very clear about how to turn it on. I thought in this tutorial, I’d show with a series of screen shots, some of the useful settings and preferences that I change to make Pale Moon a bit more private. I also thought I’d take this time to rant a little more about some of the not so savory issues with Firefox which have recently come under scrutiny by various people in the the Linux world. First order of business, if you haven’t heard, Mozilla recently added an extension into their browser which gave people ads. That’s right, they were ads for a specific t