Tue 02 May 2017 sysadmin How to deploy a Django project in 15 minutes with Ansible In this post I explain how to deploy a Django project in 15 minutes with Ansible. Automate your deploy will save you time and helps in avoiding errors.
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 …
Fri 27 May 2016 web How to add CORS headers to a Django view for use with a Cordova app Suppose you want to access some JSON data from a mobile app using Cordova. You have to bypass CORS restrictions in the web view, and to do that you have to provide some HTTP headers in your Django views. You can do this pretty easily by using this mixin in …
Wed 18 May 2016 web How to migrate your existing Django project to Heroku Recently I had some fun with Heroku, the well known PaaS provider. I had a small personal Django project I use for invoicing that I ran locally with ./manage.py runserver when needed. That was a perfect candidate for the Heroku free plan because I need to access the app …
Mon 07 December 2015 sysadmin Configure SFTP access to your Ubuntu server through SSH 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 …
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 …
Thu 04 June 2015 mobile Using HTML5 Canvas to build and share images from an Ionic/Cordova app Sometimes it can be useful to share an image from your Cordova app to other apps, such as Facebook or Whatsapp. Social Sharing plugin for Ionic/Cordova First I looked for a plugin to share content from a Ionic app in the most simple and generic way. I discovered the …
Wed 20 May 2015 mobile How to automatically sign your Android apk using Ionic framework and Crosswalk I discovered a simple trick that can be a great time saver when you are building your app using Ionic Framework and the Crosswalk web view. In few steps you’ll be able to automate the production of release signed apks of your app, ready to be published on 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? 😉