Sat 12 June 2021 snippets Integrate Axios with Django Rest Framework In this quick tutorial I'll show you how to integrate Axios and Django Rest Framework with only few lines of code.
Thu 09 January 2020 snippets Convert a Mercurial repository to Git As you may know Bitbucket is sunsetting Mercurial support, so this is a perfect time to understand how to convert a Mercurial repository to Git. Here I’ll show how to do it very quickly on Ubuntu 18.04.
Wed 11 December 2019 snippets How to log raw XML requests and responses in Suds Suppose you are using Suds and you want to log every raw XML request and response to a SOAP service. This can be useful to debug an integration with a SOAP web service.
Thu 09 November 2017 snippets A Django custom command to write model fields on an Excel file Suppose you need to write down your model fields on an Excel file, for example to complement the documentation of your code. Django has built in functions to introspect models and fields of an app, and you can leverage this API to have the information you need. You can use …
Thu 16 February 2017 snippets Drop all tables in a database Sometimes it can be useful to completely drop all tables in a database, for example to reset a DB to a previous version from a backup. After checking that you are doing this on the right database and that you know what you are doing, you can do this: SET …
Mon 01 August 2016 snippets Batch resize JPEG images with maximum resolution and size Just discovered a quick and dirty way to resize a bunch of jpeg files to a maximum resolution and size: mogrify -resize 1024x1024 -strip -define jpeg:extent=200kb *.jpg This command will resize all jpg images in the current directory with a maximum resolution of 1024px for each side (maintaining …
Thu 22 October 2015 snippets A simple script to update a DB migration in Django 1.7+ 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. South had the update flag for the …
Wed 08 October 2014 snippets Why I love Python – Expressiveness Here is one of those little things that make me love Python: d = {'a': (1,2), 'b': (3,4)} for k, (a, b) in d.items(): print k, a, b Prints: a 1 2 b 3 4 How cool is that? 😉
Fri 30 May 2014 snippets How to reset mysql root password on Ubuntu 12.04 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!