2010
01.20
Un mensaje de Javier de la Cueva acerca de las entidades de gestión despertó mi curiosidad sobre el tema. Tras pocos segundos llegué a la página del Ministerio de Cultura, donde existe una lista con las ocho entidades autorizadas en España:
- Artistas Intérpretes Sociedad de Gestión (AISGE)
- Asociación de Gestión de Derechos Intelectuales (AGEDI)
- Centro Español de Derechos Reprográficos (CEDRO)
- Derechos de Autor de Medios Audiovisuales (DAMA)
- Entidad de Gestión de Derechos de los Productores Audiovisuales (EGEDA)
- Sociedad de Artistas Intérpretes o Ejecutantes de España (AIE)
- Sociedad General de Autores y Editores (SGAE)
- Visual Entidad de Gestión de Artistas Plásticos (VEGAP)
2010
01.16
Acabo de crear una cuenta en Twitter por si le encuentro alguna utilidad, y escribo esto básicamente para probar el “acortador” de Google en mi primer “tweet”.
2010
01.08
Parece que a Google le ha dado por situar en primera posición mi página cuando alguien busca información sobre el comando depmod (al menos es así en el momento de escribir esto). Y dado que el porcentaje de rebote es del 100% para esta búsqueda, he decidido que sería una buena idea que los visitantes encuentren lo que están buscando a la primera.
Lo que viene a continuación es una reproducción casi literal de la página de manual del comando depmod que he obtenido de Ubuntu 9.10.
NAME
depmod - program to generate modules.dep and map files.
SYNOPSIS
depmod [ -b basedir ] [ -e ] [ -F System.map ] [ -n ] [ -v ]
[ version ] [ -A ]
depmod [ -e ] [ -FSystem.map ] [ -n ] [ -v ] [ version ]
[ filename... ]
DESCRIPTION
Linux kernel modules can provide services (called "symbols")
for other modules to use (using EXPORT_SYMBOL in the code). If
a second module uses this symbol, that second module clearly
depends on the first module. These dependencies can get quite
complex.
depmod creates a list of module dependencies by reading each
module under /lib/modules/version and determining what symbols
it exports and what symbols it needs. By default, this list is
written to modules.dep in the same directory. If filenames are
given on the command line, only those modules are examined
(which is rarely useful unless all modules are listed).
If a version is provided, then that kernel version's module
directory is used rather than the current kernel version (as
returned by uname -r).
depmod will also generate various map files in this directory
for use by the hotplug infrastructure.
OPTIONS
-a --all
Probe all modules. This option is enabled by default if no
file names are given in the command-line.
-A --quick
This option scans to see if any modules are newer than the
modules.dep file before any work is done: if not, it silently
exits rather than regenerating the files.
-b basedir --basedir basedir
If your modules are not currently in the (normal) directory
/lib/modules/version, but in a staging area, you can specify
a basedir which is prepended to the directory name. This
basedir is stripped from the resulting modules.dep file, so
it is ready to be moved into the normal location.
-C --config file or directory
This option overrides the default configuration file at
/etc/depmod.conf (or the /etc/depmod.d/ directory if that
is not found).
-e --errsyms
When combined with the -F option, this reports any symbols
which a module needs which are not supplied by other modules
or the kernel. Normally, any symbols not provided by modules
are assumed to be provided by the kernel (which should be true
in a perfect world).
-F --filesyms System.map
Supplied with the System.map produced when the kernel was
built, this allows the -e option to report unresolved symbols.
-h --help
Print the help message and exit.
-n --dry-run
This sends the resulting modules.dep and the various map files
to standard output rather than writing them into the module
directory.
-v --verbose
In verbose mode, depmod will print (to stdout) all the symbols
each module depends on and the module's file name which
provides that symbol.
-V --version
Show version of program and exit. See below for caveats when
run on older kernels.
COPYRIGHT
This manual page Copyright 2002, Rusty Russell, IBM Corporation.
SEE ALSO
depmod.conf(5), modprobe(8), modules.dep(5)
2009
12.21
Un pequeño programa en Python para seleccionar de forma aleatoria varios ficheros del disco duro.
#!/usr/bin/env python3.1
# -*- coding: utf-8 -*-
import configparser
import optparse
import os
import random
import re
import sys
cfg_parser = None
chk_file = None
ignore_dirs = []
paths = []
show = []
cmd_parser = optparse.OptionParser()
cmd_parser.add_option('-c', dest = 'config', type = 'string')
cmd_parser.add_option('-f', dest = 'files', type = 'string')
cmd_parser.add_option('-i', dest = 'ignore', type = 'string')
cmd_parser.add_option('-p', dest = 'path', type = 'string')
cmd_parser.add_option('-q', dest = 'quantity', type = 'int')
cmd_parser.set_defaults(path = '.')
cmd_parser.set_defaults(quantity = 5)
opts, args = cmd_parser.parse_args()
if opts.config is not None:
cfg_parser = configparser.SafeConfigParser()
cfg_parser.read(opts.config)
try:
chk_file = re.compile(
cfg_parser.get('rnd', 'files').split('\n')[0])
ignore_dirs = cfg_parser.get('rnd', 'ignore').split('\n')
paths = cfg_parser.get('rnd', 'path').split('\n')
opts.quantity = int(
cfg_parser.get('rnd', 'quantity').split('\n')[0])
except (configparser.NoSectionError,
configparser.NoOptionError):
sys.exit('Problemas de sintaxis en el fichero de ' \
'configuración...')
else:
if opts.files is not None:
chk_file = re.compile(opts.files)
if opts.ignore is not None:
ignore_dirs = opts.ignore.split(',')
paths.append(opts.path)
for ps in paths:
for root, dirs, files in os.walk(ps):
if len(ignore_dirs) > 0:
for d in ignore_dirs:
if d in dirs:
dirs.remove(d)
for f in files:
if (chk_file is not None and chk_file.match(f)) \
or chk_file is None:
show.append(os.path.join(root, f))
if 0 < opts.quantity <= len(show):
for i in range(opts.quantity):
print(show.pop(random.randint(0, len(show) - 1)))
elif 0 < len(show) < opts.quantity:
for i in range(len(show)):
print(show.pop(random.randint(0, len(show) - 1)))
else:
print('No hay ficheros para mostrar')
El programa puede recibir opciones mediante la línea de comandos o bien desde un fichero de configuración. En el primer caso solo será capaz de seleccionar ficheros que se encuentren en un mismo árbol de directorios, pero con el fichero de configuración se podrán especificiar varios árboles con los que trabajar. A continuación se muestran varios ejemplos con cada modo de funcionamiento:
Mostrar tres ficheros de extensión “avi” o “mkv” del directorio “películas“:
./random_file.py -f .*[.]\(?=avi\|mkv$\).*$ -p películas/ -q 3
Mostrar cinco ficheros cualesquiera del directorio “películas” que no se encuentren dentro del directorio “grabar“:
./random_file.py -i grabar -p películas/
Fichero de configuración correspondiente al primer ejemplo:
[rnd]
files: .*[.](?=avi|mkv$).*$
ignore:
path: películas/
quantity: 3
Fichero de configuración correspondiente al segundo ejemplo:
[rnd]
files:
ignore: grabar
path: películas/
quantity: 5
Mostrar cinco ficheros de extensión “avi” o “mkv” de los directorios “películas” o “documentales” que no se encuentren en los directorios “grabar” o “borrar“, utilizando un fichero de configuración:
[rnd]
files: .*[.](?=avi|mkv$).*$
ignore: grabar
borrar
path: películas/
documentales/
quantity: 5
./random_file.py -c random.cfg
Quizá nadie le encuentre demasiada utilidad tal y como está ahora, pero con unas pequeñas modificaciones serviría para unas cuantas cosas. Además, durante su escritura, tuve un par de ideas que podrían resultar mucho más interesantes que elegir ficheros al azar.
EDITO: se me olvidaba comentar que los ficheros de configuración que utiliza el programa siguen el formato definido por el RFC 822.