Tag Archives: tutorial
Nirvana – Smells like teen spirit Guitar Lesson
AC/DC Thunderstruck Guitar Lesson + Tutorial
Paul Wellar – changing man guitar tutorial
Andy Guitar on youtube
Ants Guitar Tutorials;
create your own search engine using searxng and linux
The excellent network chuck on youtube made a video the other day about making your own search engine with searxng so i thought id put the steps involved on doing in locally in Linux.
Update our linux installation
sudo apt update && sudo apt upgrade
install docker;
sudo apt install docker.io
install docker compose tool:
sudo apt install docker-compose
navigate to dir where you want to keep searxng, in this example well put it in “/usr/local/”
cd /usr/local
download searxng;
git clone https://github.com/searxng/searxng-docker.git
cd searxng-docker
create secret key;
sudo sed -i "s|ultrasecretkey|$(openssl rand -hex 32)|g" searxng/settings.yml
start up docker containers
sudo docker-compose up
point your browser to;
localhost:8080
Tweaks and settings;
See here for how to change things;
https://docs.searxng.org/admin/engines/settings.html#use-default-settings
refs;
https://github.com/searxng/searxng-docker
How to create a free SSL cert for your website
One of the most annoying things about having a website is the fact that you have to pay for an SSL cert and that its an extra it shouldnt be.
I dont need an SSL cert!
100% true this website is only a blog but googles chrome browser no will start warning about sites not having an SSL cert and seriously fuck google for that.
Create and install a Free SSL cert for your website with ZeroSSL in the following video. Its fairly simple and quick to do.
https://www.youtube.com/watch?time_continue=117&v=GPcznB74GPs
Getting started with Python and the Django Framework part 1
So over the christmas holidays ive been keeping myself busy by learning more about the Python language.
Having learnt a few basics i started to try the Django framework which ive seen mentioned quite a lot. Im reffering to windows mainly in this case see below for more detailed instructions;
https://docs.djangoproject.com/en/2.0/howto/windows/
Step 1:
Install python from the site below and install the necessary version for your Operating system.
https://www.python.org/downloads/release/python-364/
Step 2:
Once you get that installed, verify that python is installed by typing “python” from the windows command prompt;
Step 3:
Install Django framework via command prompt;
pip install django
Step 4:
Create your first project its best to refer to the offical document and tutorials at;
https://docs.djangoproject.com/en/2.0/intro/tutorial01/
From the offical site;
Creating a project¶
If this is your first time using Django, you’ll have to take care of some initial setup. Namely, you’ll need to auto-generate some code that establishes a Django project – a collection of settings for an instance of Django, including database configuration, Django-specific options and application-specific settings.
From the command line,
cd
into a directory where you’d like to store your code, then run the following command:$ django-admin startproject mysite
This will create a
mysite
directory in your current directory. If it didn’t work, see Problems running django-admin.
Cakephp Tips – Sort Data With the Pagnator Component
If you wanted to sort a Model by a certain field in this case take the field “created” which is a date. We can simply tell cakePHP to pagnate entries by the order they were created by the following example.
public function index() { // we prepare our query, the cakephp way! $this->paginate = array( 'limit' => 20, 'order' => array('created' => 'desc') ); $this->Link->recursive = 0; $this->set('links', $this->Paginator->paginate()); }
More Examples can be found here;
https://www.codeofaninja.com/2013/07/pagination-in-cakephp.html
CakePhp Tip #6: Displaying items that belong to a user
Displaying items that belong to a user:
One of the most common things youll do in cakephp is list items that the user should only see. For example a user should just see their “posts” listed or their “articles” etc.
CakePHP has “Magic Find Types” that can help. For example if i wanted to list all the posts of the user_id =12
In my controller i can create an action as follows;
$myposts=$this->Posts->findAllByUserId(12);
if i wanted to list all posts of the current logged in user;
public function my(){ $userid=$this->Auth->user('id'); $this->Post->recursive = 1; $this->set('posts', $this->paginate('Post',array('Post.user_id =' => $userid))); //use the index view to render $this->render('index'); }
To call view this action;
http:://localhost/mycakeapp/posts/my
Source and more info;
http://book.cakephp.org/2.0/en/models/retrieving-your-data.html
Creating a REST Service with CakePHP
This is a great tutorial about how to create a REST Service with CakePHP.
http://miftyisbored.com/complete-restful-service-client-cakephp-tutorial/