Diving into Laravel Password Reset

Laravel provides out-of-the-box users management, handling authentication, password recovery, authorization and much more. But to work it expects some preconditions, and if you violate those preconditions you have to manually re-wire many things. The precondition I've violated today is that users have not a single associated email address, but many contacts of different types are listed in a different table of the database. This implies that password recovery mechanism has no longer a mail address to which send the reset link, and everything breaks badly. Anyway, hacking around I've been…

Keep reading

Laravel Dynamic Mail Configuration

Use case: from a Laravel application, use a dynamic (database driven) configuration for sending mails. Eventually, different for each user which is actually logged in. Everywhere on the internet you find references to this thread on a forum, raccomanding to load the configuration and create a new Mailer to overwrite the one registered at bootstrap, but it is obsolete: the mentioned share method no longer exists in Laravel 5.4. Probably there is a different way to do the same thing, but I've achieved my goal in easier way: don't…

Keep reading

Semi-Auto Scaling

In those days, I had my first experience with auto-scaling of AWS EC2 instances. And, as everything in AWS, it has been a PITA to give a sense to the many obscure option and possibilities. The main issue with auto-scaling is deploying updates of the software. Due the requirements and the expected flow, and my unwillingness to deal with Ansible, Capistrano or similar devil's tools, I've organized the following setup: a reference instance for each type of server I have to auto-scale the manually inited auto-scaling groups, with related launch…

Keep reading

Next Next Cloud

Recently I've explored options for an "home server", some kind of appliance hosted at home (eventually on a dedicated RaspberryPI) and able to deliver some useful service for daily tasks. Given that the once promising FreedomBox project has become a strongly opinionated selection of random applications, and many other projects have strictly defined use cases (e.g. Kodi and Rune), the most obvious choice is NextCloud. Which indeed is conceived as a cloud application, and lacks some feature for proper home-based usage. So, I've began to implement them by myself…

Keep reading

Social Crawling

Last weekend, having nothing better to do, I'm back on the GNU Social topic and I've implemented and executed a crawler on the network, harvesting some information about users, relationships, and instances. The result is here: a force graph rappresenting the direct connections of the most followed accounts, and a chord of the connections among different instances. The crawler is still running in this moment, and many of the intercepted accounts have to be parsed looking for more connections (and more following accounts, and more connections, and more following accounts.…

Keep reading

Hard Style Sleeping - Lazy Edition

More than one year ago I managed to put a RaspberryPI and a pair of speaker on my bedside table, programmed to loudly play a dubstep music stream at a given hour to wake me up on the most brutal and effective way. It worked, but recently I had to setup different hours on different days and it was boring to daily change the configuration of the application. So I tried to introduce a more complex configuration on my little software, breaking everything. I'm too lazy to fix it, so…

Keep reading

Overcomplicating Images

Sometimes a user's "It doesn't works" becomes a story. This "It doesn't works" was about uploading images on a website. A simple task to achieve, which becomes a little more complex when a live preview is required by the usual "I need images in every page! Big images! Always!" designer. And degenerates in a complete pain in the ass when are involved photos coming from a smartphone. Somewhere, somehow, someone decided that photos (in particular, those shooted by a smartphone) had not to be saved in the final format by…

Keep reading

They Are Many

In a complex Laravel application I'm working on, I had to implement a dynamic system to integrate external and heterogeneous sources of data. So I built on the ServiceProviders feature provided by Laravel and created a ContentsDriver abstract class including the internal events handling flow and to be extended by the different effective files each implementing a source. Now I have to dynamically create those drivers on behalf of a configuration got from the database, and the whole construction breaks down: each ContentsDriver handles a single source, I would have…

Keep reading

Electrified

Recently, I wanted to prototype a simple desktop application to manage color palettes on Linux. So I fired up GNOME Builder, enjoyed his scaffolding feature for a new GTK+ Python application (still incomplete when compared to the previously mentioned tool, but far easier to use), and... as usual, I got lost on GTK+ Python documentation, trying to figure out how to obtain a proper ListItems for the initial menu using an (apparently) convenient GtkBuilder XML file. After half an hour of frustation I decided to catch the opportunity and try…

Keep reading

DNS, The Masquerade

Scenario: a RaspberryPI primarily acting as access point, assigning IPs by DHCP and catching all DNS requests to redirect all HTTP traffic to himself, which may eventually switch to connect as a client to an existing wireless network (and delegating DHCP and DNS to another access point). 90% of this stuff may be easily achieved with nmcli, the powerful and convenient command line interface for Network Manager. nmcli c add type wifi ifname wifi-device con-name myconnection \ autoconnect yes ssid myconnection nmcli connection modify myconnection \ 802-11-wireless.mode ap 802-11-wireless.band bg…

Keep reading