Sometimes you have to give your users a way to manage files on your server. A typical scenario is a web server where your users manage their websites by themselves.
The classical approach in this scenario was to use FTP to give file management capabilities to your users, but it has many drawbacks:
- You have to provision and maintain a new service on your server;
- FTP is an annoying protocol from a firewall configuration point of view;
- FTP is not encrypted by default, and you have to put some effort to configure an FTP server which is protected from sniffing.
If you are a lazy sysadmin like me you’ll prefer to use a service you already have, which is encrypted by default and do not require a special firewall configuration other than the port 22 you are already using.
ssh to the rescue!
During the development of a Django model on your local machine is it often necessary to refine the most recent migration to cope with updates to the model, without polluting the migrations of the app with a new migration for each local update.
So I put togheter a simple bash script to automate the process.
In few steps you’ll be able to automate the production of release signed apks of your app, ready to be published on the Google Play Store.
Here is one of those little things that make me love Python: Prints: a 1 2 b 3 4 How cool is that? ;)
Assume that you have a Django project where each user belongs to just one group, say Registered or Admin, but not both.
You want to show a form in your front-end to let Admin users edit the user profiles, where each user profile is made with First name, Last name, Email and the user group.
This task can be accomplished very easily! What you need is a customized ModelForm to add the possibility to edit the user group together with the other fields, and a customized UpdateView to let you set the form initial data for the group field, and to save the changes correctly.
Sometimes it could be useful and elegant to have a Django view responding to more that GET and POST requests, implementing a simple REST interface. In this post I’ll show how you can support PUT and DELETE HTTP requests in Django.
Google Cloud Print (GCP) is a quite useful Google service, allowing you to print in a GCP compliant printer from everywhere and from every device of yours, be it a desktop, a tablet or a smartphone. There are quote a lot of printers out there supporting GCP out of the box, but here I will explain how to turn every Linux supported printer in a fully functional GCP printer. As a bonus you’ll have a cheap Linux based print server in your local network, which is alone a nice thing to have. All this thank to the amazing Raspberry PI ARM GNU/Linux mini PC.
Fast and easy! $ sudo stop mysql $ sudo -umysql mysqld_safe --skip-grant-tables & $ mysql mysql> UPDATE mysql.user SET Password=PASSWORD('newpassword') WHERE User='root'; mysql> FLUSH PRIVILEGES; $ sudo kill `cat /var/run/mysqld/mysqld.pid` $ sudo start mysql Enjoy your new mysql root password!