Programming as Theory Building: Peter Naur's Essay

Posted on Mon, 18 May 2026 in Programming • Tagged with programming, theory, architecture, ai, llm, naur

The key ideas from Christian Ekrem's article on Peter Naur's essay and why it matters more than ever in the age of generative AI.


Continue reading

Markdown Preview in Kate Editor with markdownpart

Posted on Mon, 11 May 2026 in Linux • Tagged with kate, markdown, linux, kde, editor

How to enable live Markdown preview in Kate using markdownpart.


Continue reading

Configuring udev permissions for Vial on Linux

Posted on Mon, 11 May 2026 in Linux • Tagged with vial, linux, udev, keyboard, keychron, qmk

How to set up udev rules so Vial can detect your Vial-firmware keyboard on Linux, using the universal magic serial rule.


Continue reading

GitHub Spec Kit — Specifications as Source of Truth

Posted on Sun, 10 May 2026 in ia • Tagged with agents, ai, spec-kit, github, spec-driven-development

Sixth installment in the series on software engineering with AI agents. Today we look at the project that GitHub has turned into the de facto standard for specification-driven development: Spec Kit.

So far we have covered methodologies for directing agents: compound engineering (Every), discipline skills (Addy Osmani), a complete operating …


Continue reading

Matt Pocock — Simple Skills That Work

Posted on Wed, 06 May 2026 in ia • Tagged with agents, ia, skills, matt-pocock, claude-code

Fifth installment of the series on software engineering with agents. Today it is the project that is taking off right now: Matt Pocock's skills.

I have covered Superpowers (Jesse Vincent), Agent Skills (Addy Osmani), and Compound Engineering (Every). Each brings an important piece of the puzzle. But Matt Pocock's skills …


Continue reading

Superpowers — Jesse Vincent Imposes Methodology on Coding Agents

Posted on Wed, 06 May 2026 in ia • Tagged with agents, ai, superpowers, jesse-vincent, claude-code, prime-radiant

Fourth installment in the series on agent-driven software engineering. Today I am covering a project that has changed the game: Superpowers, by Jesse Vincent.

With 180,000 stars on GitHub and 16,000 forks, Superpowers is the most popular agent skills framework today. But what makes it special is not …


Continue reading

Agent Skills by Addy Osmani — Enforcing Senior Engineering Discipline on Agents

Posted on Wed, 06 May 2026 in ia • Tagged with agents, ai, agent-skills, addy-osmani, google, claude-code

In the previous two parts of this series we have seen an overview of agent-driven engineering and then Every's compound engineering methodology. Now for another similar approach: Agent Skills, Addy Osmani's project at Google that has nearly 30,000 stars on GitHub and tackles the problem from a completely different …


Continue reading

Compound Engineering — Every's Vision for Agent-Driven Engineering

Posted on Wed, 06 May 2026 in ia • Tagged with agents, ai, compound-engineering, every, claude-code

In the first part of this series I talked about how AI agents have changed the way I build software. But that was just the warm-up. What follows is the vision of a company that has taken this idea to the extreme: Every, the startup from Dan Shipper and Kieran …


Continue reading

Programming with Agents

Posted on Wed, 06 May 2026 in ia • Tagged with agents, ai, productivity

After more than 20 years of writing code, the rise of AI agents has changed how I work more than any new framework or language ever could. It is not about the AI writing code for me, but about letting me stay focused on what actually matters: design, architecture, and …


Continue reading

Winhance: clean and optimize Windows without reinstalling

Posted on Tue, 05 May 2026 in Herramientas • Tagged with windows, debloater, herramientas, winhance

Winhance is a C# utility to debloat, optimize, and customize Windows 10/11 without needing to reinstall the system.


Continue reading

Pi subagent extensions: TintinWeb, NicoBailon and Taskplane

Posted on Sun, 03 May 2026 in IA • Tagged with pi, coding-agent, subagentes, extensiones, cli, herramientas

A comparison of three extensions for running subagents in pi — TintinWeb, NicoBailon, and Taskplane — each with a different approach.


Continue reading

DNS blocking of AliExpress links with NextDNS

Posted on Sun, 03 May 2026 in Infraestructura • Tagged with dns, nextdns, aliexpress, bloqueo, linux

Using an overly aggressive DNS blocklist in NextDNS broke AliExpress affiliate links. Diagnosed with dig and fixed by switching to HaGeZi Multi PRO.


Continue reading

Double-sided scanning with the Brother DCP-L3560CDW

Posted on Sun, 03 May 2026 in Infraestructura • Tagged with brother, impresora, escaner, linux, simple-scan, paperless

Workaround for scanning double-sided documents with the Brother DCP-L3560CDW and its simplex document feeder.


Continue reading

marksman: Markdown LSP

Posted on Wed, 29 Apr 2026 in Herramientas • Tagged with markdown, lsp, fresh, editor, linux

marksman is a language server protocol (LSP) implementation for Markdown that adds autocompletion, cross-file navigation, and error detection to any compatible editor.


Continue reading

The Price Hike of SBCs (Single Board Computers)

Posted on Tue, 28 Apr 2026 in Linux • Tagged with raspberry-pi, sbc, hardware

La subida de los 'cacharritos'


Continue reading

neofetch

Posted on Mon, 27 Apr 2026 in Herramientas • Tagged with linux, terminal

Neofetch, a command-line system information tool.


Continue reading

Rufus, the best way to install a clean Windows

Posted on Mon, 27 Apr 2026 in Herramientas • Tagged with rufus, windows, instalacion

Rufus, a great tool for creating Windows installation media, allowing you to disable Microsoft's forced AI integrations.


Continue reading

Trying Aurora: my first look at the future of the Linux desktop

Posted on Fri, 24 Apr 2026 in Linux • Tagged with aurora, kde, escritorio, devcontainers, homebrew

Aurora: Image-based, atomic updates, devcontainers, homebrew, and the whole DX experience I'm testing in a VM.


Continue reading

Expand Aurora VM disk on Unraid and resize partitions

Posted on Fri, 24 Apr 2026 in Linux • Tagged with aurora, unraid, vm, btrfs, disco

How to expand the virtual disk of an Aurora VM running on Unraid and resize Btrfs partitions within the operating system.


Continue reading

Rust eBooks Nightly — Rust books in EPUB, AZW3, MOBI, and PDF

Posted on Tue, 21 Apr 2026 in Programación • Tagged with rust, ebooks, epub, calibre, github actions

Artur Sulej's project that automatically builds and publishes the latest versions of top Rust books as eBooks. Updated daily.


Continue reading

Disable git autocrlf

Posted on Tue, 21 Apr 2026 in Programación • Tagged with git, windows, wsl, line endings

If you use Windows (or WSL), Git has been silently converting your line endings. One command fixes it.


Continue reading

Installing GitHub Skills

Posted on Sun, 19 Apr 2026 in Programación • Tagged with github, cli, agentes-ia, skills

Comparing gh skill vs npx skills for installing and managing AI agent skills.


Continue reading

Velvet OS: modern kernels for old ARM hardware

Posted on Fri, 17 Apr 2026 in Linux • Tagged with kernel, arm, odroid, orangepi, velvet-os, sbc

Mental note about Velvet OS, an interesting project to update kernels on old ARM devices.


Continue reading

Video Creation with Gemini: Seville Characters

Posted on Wed, 15 Apr 2026 in IA • Tagged with gemini, google, video, sevilla, ia

Testing Gemini's video generation with Seville-based characters.


Continue reading

Google Stitch: UI generation and prototyping with AI

Posted on Mon, 13 Apr 2026 in Herramientas • Tagged with ia, ui, design, gemini, prototipado

Overview of Google Stitch as a tool for generating user interfaces and interactive prototypes using artificial intelligence.


Continue reading

rbw sync: missing field `access_token`

Posted on Sat, 11 Apr 2026 in Linux • Tagged with bitwarden, cli, bug, vaultwarden

Known rbw bug when syncing with Bitwarden or Vaultwarden: "failed to parse JSON: missing field access_token". The fix is to clear the local cache.


Continue reading

rbw-env: Export environment variables from Bitwarden

Posted on Thu, 26 Mar 2026 in Herramientas • Tagged with bitwarden, cli, entorno, productividad, seguridad

Using rbw to export environment variables from Bitwarden, useful for setting API keys securely without storing them on disk.


Continue reading

Crit: The Review Loop for Agents

Posted on Sun, 22 Mar 2026 in Programación • Tagged with ia, agents, review, opencode, productividad

Crit is a tool designed to close the code review loop for AI-generated code, providing an intuitive and efficient web interface.


Continue reading

Hidden gems in pi-powerline-footer

Posted on Sun, 22 Mar 2026 in IA • Tagged with pi, terminal, productividad

Two features of the pi-powerline-footer plugin that go beyond the typical footer with model information.


Continue reading

Agent Browser: Browser Navigation for AI Agents

Posted on Wed, 18 Mar 2026 in IA • Tagged with agent-browser, ia, agents, automation, llm, pi-agent, pi

agent-browser is a tool from Vercel that allows AI agents to navigate the web and perform actions just like a human would, easily integrating with agent frameworks.


Continue reading

Tailscale Aperture: AI Gateway Without Distributing API Keys

Posted on Mon, 16 Mar 2026 in Herramientas • Tagged with tailscale, seguridad, ia, api, gateway

Tailscale's Aperture centralizes LLM access by eliminating the need to distribute API keys to developers, using Tailscale identity for authentication.


Continue reading

sem: Semantic Version Control

Posted on Sun, 15 Mar 2026 in Programación • Tagged with cli, versionado, rust, herramientas

Discovering sem, a CLI tool that understands your code's semantics and tells you what entities changed, not just what lines.


Continue reading

os.click: Operating System ISO Download Center

Posted on Thu, 12 Mar 2026 in Programación • Tagged with linux, windows, iso, operating systems, herramientas

Quick reminder about os.click for downloading official ISOs.


Continue reading

From net-tools to iproute2: command equivalents

Posted on Fri, 06 Mar 2026 in Linux • Tagged with redes, iproute2, net-tools, terminal

A guide to equivalents between classic net-tools commands (ifconfig, route, arp) and modern iproute2 commands (ip).


Continue reading

Fixing Rodney Chrome Error on Wayland

Posted on Fri, 06 Mar 2026 in Herramientas • Tagged with rodney, chrome, wayland, linux, debugging

How to fix Rodney crash when starting Chrome on Wayland systems by using the system Chrome.


Continue reading

Record and Share your Terminal Sessions with asciinema

Posted on Fri, 27 Feb 2026 in Herramientas • Tagged with asciinema, terminal, linux, productividad

Discover asciinema, the perfect tool to record your terminal sessions in a lightweight, reproducible, and easy-to-share way.


Continue reading

kitty-rbw: Fast Bitwarden access from your kitty terminal

Posted on Thu, 26 Feb 2026 in Herramientas • Tagged with bitwarden, cli, kitty, rust, productividad

Introducing kitty-rbw, a "kitten" for the kitty terminal that allows you to search and use rbw (Bitwarden) credentials instantly using fzf.


Continue reading

rbw: The Bitwarden terminal client you should be using

Posted on Thu, 26 Feb 2026 in Herramientas • Tagged with bitwarden, cli, rust, seguridad, pi-agent

How to install and configure rbw, a Rust implementation of the Bitwarden client, and how to integrate it into your workflows with pi-agent.


Continue reading

DeepDiff: The Swiss Army Knife for Data Comparison in Python

Posted on Fri, 20 Feb 2026 in Programación • Tagged with data, cli, herramientas, diff

When working with structured data in Python, we often need to compare two dictionaries, JSONs, or complex objects to find out what has changed. While direct comparison (==) is useful, sometimes we need to understand exactly what is different: which keys were added, which were removed, or where values have changed …


Continue reading

Rendering Markdown in the terminal with Glow

Posted on Fri, 20 Feb 2026 in Linux • Tagged with cli, markdown, herramientas, kitty

Discover Glow, a tool to render Markdown directly in the terminal, ideal for reading documentation and READMEs.


Continue reading

Shot-scraper: Automated Web Screenshots

Posted on Fri, 20 Feb 2026 in Programación • Tagged with cli, herramientas, web, scraping, screenshots

Have you ever needed to take screenshots of a web page programmatically? Perhaps to document your project, monitor UI changes, or generate images for social media. There are many ways to do it, but shot-scraper stands out for its ease of use and power.

Created by Simon Willison, shot-scraper is …


Continue reading

Stern: Kubernetes Logs on Steroids

Posted on Fri, 20 Feb 2026 in Infraestructura • Tagged with kubernetes, cli, logs, herramientas

If you work with Kubernetes, you've probably suffered through the kubectl logs command. It's useful for viewing the logs of a specific pod, but it falls short when you have multiple replicas of a service or when pods restart and change names.

This is where Stern comes in.

Stern allows …


Continue reading

Managing GitHub installations with gah

Posted on Wed, 11 Feb 2026 in Linux • Tagged with herramientas, cli

Install binaries directly from GitHub releases easily with gah.


Continue reading

broot, a different way to navigate your directories

Posted on Fri, 02 Jan 2026 in Herramientas • Tagged with terminal, cli, broot, rust

broot is a terminal tool for interactive directory exploration with fuzzy search, multiple panels, and file preview.


Continue reading

Multiline YAML: Understanding and testing complex strings

Posted on Thu, 25 Dec 2025 in Herramientas • Tagged with yaml, configuracion, desarrollo, multiline, strings

Explore YAML options for effectively handling multiline strings, with an interactive demo that allows you to test them in real-time.


Continue reading

Pandas Styler: Improve the Presentation of your DataFrames

Posted on Thu, 25 Dec 2025 in Programación • Tagged with pandas, data-science, visualizacion, estilo

Discover how the Pandas Styler object allows you to apply conditional formatting and CSS styles to your DataFrames for better data visualization and presentation.


Continue reading

`fresh`: My preferred terminal editor for daily use

Posted on Thu, 25 Dec 2025 in Herramientas • Tagged with fresh, terminal, editor, productividad, linux, cli

Discover fresh, a fast, modern, modeless terminal text editor, ideal for casual file editing, surpassing nano and vim in simplicity for regular use.


Continue reading

How to View Files in an RPM Package on Linux

Posted on Thu, 25 Dec 2025 in Infraestructura • Tagged with linux, rpm, paquetes, comandos, administracion, dnf, yum

Quick guide to inspecting the contents of RPM packages and determining which packages own specific files on your Linux system.


Continue reading

Kooha: Simple and Elegant Screen Recording on Linux

Posted on Thu, 25 Dec 2025 in Herramientas • Tagged with linux, kooha, screen-recorder, productividad, open-source

Discover Kooha, a minimalist screen recording application for Linux that combines ease of use with essential features.


Continue reading

OpenEvidence: The Leading Medical Information Platform for Professionals

Posted on Thu, 25 Dec 2025 in Personal • Tagged with open-evidence, medicina, salud, informacion-medica, profesionales-salud, investigacion, clinica

Exploring OpenEvidence, a leading platform that consolidates medical information, clinical findings, and practice guidelines for healthcare professionals in the US.


Continue reading

`direnv`: Manage your development environments intelligently

Posted on Thu, 25 Dec 2025 in Herramientas • Tagged with direnv, shell, entorno, productividad, desarrollo, linux

Discover direnv, a shell extension that automatically loads and unloads environment variables when changing directories, keeping your configuration clean and organized.


Continue reading

`docker-http-https-echo`: An Essential Tool for Network Debugging

Posted on Thu, 25 Dec 2025 in Herramientas • Tagged with docker, http, https, debugging, redes, contenedores

mendhak/docker-http-https-echo is a simple Docker container that facilitates debugging network configurations, proxies, and load balancers.


Continue reading

Kubegres: Simplified PostgreSQL Management on Kubernetes

Posted on Thu, 25 Dec 2025 in Infraestructura • Tagged with kubernetes, postgresql, kubegres, operador, base-de-datos

Discover Kubegres, a Kubernetes operator that simplifies the deployment and management of highly available and scalable PostgreSQL clusters.


Continue reading

TCP Connection States in GNU/Linux: netstat and ss

Posted on Thu, 25 Dec 2025 in Infraestructura • Tagged with linux, tcp, netstat, ss

Understand the different TCP connection states reported by netstat and ss, from establishment to termination, for better network diagnosis.


Continue reading

Reduce Noise in Your Python Logs: A Smart Approach

Posted on Thu, 25 Dec 2025 in Programación • Tagged with logging, logs, debugging, desarrollo

Learn how to configure Python's logging module to avoid message overload from third-party libraries, keeping your logs clean and useful.


Continue reading

Kitty as a Quick Access Terminal: The Convenience of a Dropdown

Posted on Thu, 25 Dec 2025 in Infraestructura • Tagged with kitty, terminal, acceso-rapido, productividad, linux, atajos

Configure Kitty for instant and efficient access, combining the power of a modern terminal with the convenience of a dropdown.


Continue reading

Essential Keyboard Shortcuts in Kitty: Mastering Your Terminal

Posted on Thu, 25 Dec 2025 in Infraestructura • Tagged with kitty, terminal, atajos, teclado, productividad

A quick guide to the most useful Kitty keyboard shortcuts to optimize your command-line workflow.


Continue reading

From Yakuake to Kitty: My Transition to a Modern Terminal

Posted on Thu, 25 Dec 2025 in Infraestructura • Tagged with kitty, yakuake, terminal, linux, productividad, herramientas

Exploring the reasons and benefits of switching from Yakuake to Kitty for a more powerful and customizable terminal experience.


Continue reading

Poe the Poet: Automating Tasks in Python Projects with uv

Posted on Thu, 25 Dec 2025 in Programación • Tagged with uv, poethepoet, automation, pyproject.toml

Discover how Poe the Poet allows you to define and execute custom commands directly from your pyproject.toml, optimizing your workflow in uv environments.


Continue reading

How I Use Git Worktrees for Concurrent Work

Posted on Wed, 23 Jul 2025 in Programación • Tagged with git, worktrees, flujo-trabajo, productividad

A practical approach to using git worktrees and maximizing productivity with multiple simultaneous work contexts


Continue reading

Hybrid Search with SQLite: Vector + Full-Text

Posted on Sun, 06 Oct 2024 in Programación • Tagged with sqlite, busqueda, vectores, fts, sql

Combining vector search and full-text search in SQLite using Reciprocal Rank Fusion for better results


Continue reading

Geospatial Data Conflation with DuckDB and Embeddings

Posted on Tue, 01 Oct 2024 in Programación • Tagged with duckdb, geoespacial, embeddings, ollama, h3

Advanced techniques to integrate geospatial data sources using DuckDB, H3, Ollama, and embedding models


Continue reading

HTTPX: Modern HTTP Client for Python

Posted on Mon, 23 Sep 2024 in Programación • Tagged with http, httpx, async, requests

HTTPX emerges as the natural successor to requests, offering async support, HTTP/2, and a modern API for contemporary Python applications.


Continue reading

Server-Sent Events: Simplified Real-Time Communication

Posted on Mon, 23 Sep 2024 in Programación • Tagged with javascript, sse, tiempo-real, web-apis

Server-Sent Events offer a simple and efficient alternative to WebSockets for unidirectional server-to-client communication in web applications


Continue reading

About Versions

Posted on Mon, 01 May 2017 in Programación


Continue reading

MobaXterm. Much more than an ssh client

Posted on Tue, 11 Apr 2017 in Herramientas • Tagged with linux


Continue reading

PosteRazor: Create Giant Posters from Any Image

Posted on Fri, 24 Feb 2017 in Herramientas • Tagged with posterazor, printing, posters, diy

PosteRazor converts any image into a giant poster by splitting the image into printable pages that you can assemble


Continue reading

Unread Mail in Gmail's Primary Tab

Posted on Thu, 28 Jul 2016 in Herramientas • Tagged with linux

As always, another reminder note.

If you filter mail in gmail by unread (is:unread), you get all unread mail, which in my case always includes hundreds of notifications, social, promotions, or forums which is usually not what I'm looking for.

To search for unread emails from the Primary tab …


Continue reading

Technical Documentation with Sphinx, Paver, and Cog

Posted on Thu, 14 Jul 2016 in Documentación • Tagged with sphinx, paver, cog, rst, automation

Automated workflow to create technical documentation using Sphinx, Paver, and Cog, eliminating repetitive tasks and manual errors in code examples


Continue reading

Determining RAM slots in use on Linux

Posted on Wed, 13 Jul 2016 in Linux • Tagged with ram, dmidecode, lshw, hardware, memoria

Linux commands to determine how many RAM slots are occupied and their capacity using dmidecode, lshw, and hardware inspection techniques


Continue reading

Introduction to High-Frequency Trading Systems

Posted on Mon, 27 Jun 2016 in Finanzas • Tagged with trading, hft, high-frequency, algoritmos

Fundamental concepts about High-Frequency Trading (HFT) systems, programs that execute thousands of trades per day in fractions of a second


Continue reading

How to Find Live Hosts on Your Local Network

Posted on Mon, 27 Jun 2016 in Infraestructura • Tagged with nmap, network-discovery, arp-scan, netdiscover

Methods and tools to discover active devices on local networks using nmap, arp-scan, netdiscover, and other reconnaissance techniques


Continue reading

Powerful Command Line Tools for Developers

Posted on Tue, 07 Jun 2016 in Herramientas • Tagged with cli, desarrollo, redes, testing

Collection of essential command line tools for developers: curl, ngrep, netcat, sshuttle, siege, and mitmproxy


Continue reading

Sysdig: Cloud-Native Security Platform with AI

Posted on Wed, 10 Feb 2016 in Herramientas • Tagged with sysdig, seguridad, cloud, kubernetes, falco

Sysdig offers a comprehensive security platform for cloud-native environments that combines AI, real-time visibility, and open source innovation


Continue reading

Python: Create Repeating Generators

Posted on Tue, 09 Feb 2016 in Programación • Tagged with generadores, itertools, decoradores, yield

Techniques in Python to create generators that can be iterated multiple times, overcoming the "one-shot" limitation of standard generators


Continue reading

Middle click in firefox

Posted on Fri, 01 Jan 2016 in Infraestructura • Tagged with linux

Stop firefox from opening the pasted url with the middle mouse button


Continue reading

Bootstrap: Two Links in the Same Row in Dropdown

Posted on Tue, 15 Dec 2015 in Programación • Tagged with bootstrap, css, dropdown, flexbox, html

CSS technique to place two links on the same horizontal row within a Bootstrap dropdown menu using flexbox


Continue reading

Galen Framework: Automated Testing for Responsive Design

Posted on Fri, 13 Nov 2015 in Programación • Tagged with galen, testing, responsive, layout, selenium

Galen Framework simplifies automated testing of responsive layouts by verifying the position and appearance of elements across different devices


Continue reading

The Story Behind X-Forwarded-For and X-Real-IP

Posted on Wed, 21 Oct 2015 in Infraestructura • Tagged with headers, x-forwarded-for, x-real-ip, proxy, nginx

Analysis of X-Forwarded-For and X-Real-IP headers, their origins, differences, and how to determine the client's real IP in architectures with multiple proxies


Continue reading

Nginx: Configuring X-Forwarded-For in Reverse Proxy

Posted on Wed, 21 Oct 2015 in Infraestructura • Tagged with nginx, reverse-proxy, x-forwarded-for, ip-real, configuracion

How to configure Nginx to pass the client's real IP to backend servers using the X-Forwarded-For header in reverse proxy configurations


Continue reading

SQL: Select Rows with Max Value per Group

Posted on Wed, 21 Oct 2015 in Programación • Tagged with sql, mysql, consultas, window-functions, joins

SQL techniques to select complete rows with the maximum value of a column within groups, comparing performance of subqueries, joins, and window functions


Continue reading

Repeating a function with threads

Posted on Sun, 03 May 2015 in Programación

Let's use threads in python to periodically execute a function


Continue reading

Install InSync on Opensuse

Posted on Mon, 20 Apr 2015 in Infraestructura • Tagged with django, python


Continue reading

NetHogs see consumed bandwidth

Posted on Thu, 16 Apr 2015 in Infraestructura • Tagged with linux

To measure the bandwidth I am using right now, I use NetHogs

By default, it looks for a network interface called "eth0". If it doesn't find it, it complains like this:

ioctl failed while establishing local IP for selected device eth0. You may specify the device on the command line …

Continue reading

Google Code is Closing

Posted on Fri, 13 Mar 2015 in Programación

As I said, Google announced the closure of Google Code.

Today I received the email notifying me (I had a test project hosted there) that I could move my projects simply to github, the de facto repository for free software today (sorry for bitbucket and especially for mercurial).

Its interface …


Continue reading

pgcli the discovery of the day

Posted on Mon, 02 Mar 2015 in Programación • Tagged with postgresql

postresql command line


Continue reading

Blogging again

Posted on Fri, 20 Feb 2015 in Personal • Tagged with python

I am writing again.


Continue reading

Ajax view decorator

Posted on Fri, 21 Nov 2014 in Programación • Tagged with django

To force a django view to be called only via AJAX calls.

def ajax_required(f):
    """
    AJAX request required decorator
    use it in your views:

    @ajax_required
    def my_view(request):
        ....

    """
    def wrap(request, *args, **kwargs):
        if not request.is_ajax():
            return HttpResponseBadRequest()
        return f(request, *args, **kwargs)
    wrap.__doc__ = f.__doc__
    wrap.__name__ …

Continue reading

Generic function to use as upload_to

Posted on Sat, 11 Oct 2014 in Programación • Tagged with django

FileFields in Django need an upload_to function that determines where the file will be uploaded. I usually have a generic function in utils.py that leaves them in a subfolder with the model name.

import os

def generic_upload_to(instance, filename):
    """
    Generic `upload_to` function for models.FileField and models.ImageField
    which …

Continue reading

Django: links in object list

Posted on Wed, 21 May 2014 in Programación • Tagged with django

In my projects I usually use links to related items in the admin change_list.

utils.py

I have this in utils.py

from django.contrib import admin
from django.contrib.contenttypes.models import ContentType
from django.core import urlresolvers
from django.utils.datastructures import SortedDict …

Continue reading

Settings vars processor

Posted on Wed, 08 Jan 2014 in Programación • Tagged with django

I usually use this at the beginning of projects.

from django.conf import settings as django_settings
from django.core.exceptions import ImproperlyConfigured


def settings(request):
    """
    Adds the settings specified in settings.TEMPLATE_VISIBLE_SETTINGS to
    the request context.
    """
    new_settings = {}
    for attr in django_settings.TEMPLATE_VISIBLE_SETTINGS:
        try:
            new_settings[attr] = getattr(django_settings, attr)
        except AttributeError …

Continue reading