I have not forgotten this project. I have been slowly been adding to the shell script to include reban functionality to it behind the scenes. Overall, Reddit users gave it a warm reception (which I’m grateful for and have been really encouraged) but it has fallen by the wayside somewhat during my endevour to finish the CS50 course. Also there hasn’t been too much demand for this script either which also suggests that completeness can wait a little.
There is another fail2ban script that I would like to go ahead and write; automatically print the statuses of current jails on screen with one command. The script shall read input of the required jails from a file that can be edited by the user.
This script will save a lot of time, especially if there are many jails to check. Again, I’m sure that someone may find this useful, somewhere! I’ll post an update when this is closer to being published on github.
So it seems we have left C behind and now entering the world of python. The lecture about machine learning is a great informative lecture that has really captured my imagination and helped me to understand some of the things that we take for granted. It also helped me to better understand the notion of machine learning whilst reading into new technological developments.
I might even learn how to put the theory into practice one day when I try to work towards a “rather grand” project that I have been thinking about making:
I have been thinking about building an autonomous robot that can cut grass! Ok sure, this might be a bit adventurous and my skills are lacking quite a bit behind; but I’m slowly building up a mental image of the processes and procedures in order to get to that stage. All baby steps mind!
Some of the jumps being made in the course are getting steeper, mind, and will require a bit more endepth research into python in order to get to the same level that I was at in C. I am at the stage where I could happily write some code in C and end up with a nice little tool or program. Onwards and upwards!
I’m working towards completing the Harvard’s CS50 (computer science) course. Currently, I am working on PSET5 (week5), and I would like to talk about my choice for this problem.
The task is to make a program that checks the spelling of some given text against a dictionary of words which are known to be correct. Now as far as I can tell, the framework for the different inputs (dictionary, text) is already part of the sourcecode, however the problem is how to go about populating a data structure to store the good words, how you verify the text against the good words and how to manipulate the dictionary by adding to or deleting the entire dictionary.
So far, I have built my own test trie (or tree) data structure and have most of the functionality of the specification of PSET5 in a working example. I’m just yet to implement the function to check the text words to the good words and to figure out how to enumerate the all the words in the trie (but I have a pretty good idea on how I will do this)
Now it’s just the “simple” matter of interweaving my working example to the base code provided without breaking anything and giving full functionality! Wish me luck.
I have spent almost 2 evenings trying to create a C program to convert Hex (0x) into a decimal number. After re-writing it 3 times, I had figured out the logical structure.
A previous little program I wrote returned the total decimal value of a provided number of bits. For that program, I was able to use:
1 << i;
to provide me with “1 to the power of i”. I couldn’t figure out why this formula didn’t work at all with ^16; 1^16 kept returning a value of 32. I finally gave up and found a different route.
<math.h> gave me a function that returns the value of a powerof equation.
double pow(double x, double y);
You must also include -lm flag whilst compiling. After implementing the function, the whole program started returning correct results. Job done. Here’s the code ( if your interested ) Continue reading “C: Power of (^) & hex to dec converter”