User:Emijrp/Things I usually forget

From Wikipedia, the free encyclopedia

WLM[edit]

  • sql p_erfgoed_p (WLM monuments database)

dispenser coordinates databases[edit]

dumps[edit]

  • Para hacer un dump: mysqldump -u USER -pPASSWORD wikidb > wikidbbackup.sql
  • Para restaurar un dump: mysql -u USER -pPASSWORD wikidb < wikidbbackup.sql

svn merge (revertir versiones en svn)[edit]

_mysql vs mysqldb[edit]

Con estos dos módulos se pueden hacer consultas mysql en python. El primero no te trae todo el resultado a memoria, sino que lo va parseando poco a poco, el segundo te consume toda la RAM.

API[edit]

jeremyb: wikipedia.query.GetData({'action':'query', 'prop':'imageinfo', 'iiprop':'url|size', 'generator':'categorymembers', 'gcmtitle':'Category:Human', 'gcmprop':'title', 'gcmnamespace':'14|6', 'gcmlimit':'15'},site=wikipedia.Site('commons','commons'),useAPI=True)

free geoip[edit]

http://software77.net/faq.html

R[edit]

  • paquetes de mapas: install.packages('maps')
    • también apt-get install r-cran-map*^(4 paquetes salen)
  • ejemplos con otros paquetes [1]

Servidores de Toolserver[edit]

>	OK.
[00:12:55]	But I always work on nightshade, when I need another server?
[00:13:19]	<DaBPunkt>	How should we know where you work? :-)
[00:13:38]	we have also willow, which runs solaris or cassini for the OSM-people
[00:13:48]	<msgbot_>	(resolved) [TS-572] Install ZODB for Python <https://jira.toolserver.org/browse/TS-572> (DaB.)
[00:13:50]	<DaBPunkt>	or wolfsbane for the web
	<DaBPunkt>	(which runs also solaris)

Tutorial usuarios Toolserver[edit]

s1, s2, s3[edit]

consulta cualquiera desde consola[edit]

'mysql -h %swiki-p.db.toolserver.org -e "use %swiki_p;select user_name, user_editcount from user where user_editcount!=0 order by user_editcount desc limit 5000;" > /home/emijrp/...../file.data'

mysql fechas[edit]

  • rc_timestamp>=date_add(now(), interval -1 day)

phpmyadmin[edit]

Conectarse al phpmyadmin de toolserver.org [3]:

  1. https://phpmyadmin.toolserver.org/
  2. Meter pass asignada con setpass [4] (si se me olvida puedo volver a crearla con setpass desde la consola)
  3. Meter pass sql
  4. Ya estoy dentro, buscar las u_emijrp

Importar un .sql a una bbdd[edit]

  1. Conectarse al phpmyadmin
  2. Elegir la bbdd
  3. Importar el fichero (debe tener inserts)
    1. INSERT INTO `imagesforbio` (`id`, `language`, `article`, `image`, `url`, `done`) VALUES (NULL, 'es', 'b', 'b.jpg', 'ss', 0);

o también:

  • mysqldump -u root -p midb < midb.sql

Ejemplo de md5[edit]

k2_=re.sub(' ', '_', k2) #espacios a _
md5_=hashlib.md5(k2_.encode('utf-8')).hexdigest() #digest hexadecimal, previous python versions: md5.new()
url="http://upload.wikimedia.org/wikipedia/commons/%s/%s/%s" % (md5_[0], md5_[0:2], k2_) #truco del almendruco

password en user-config.py[edit]

Poco recomendable pero...

        <valhallasw>	# password_file = ".passwd"
	<valhallasw>	# A password file with default passwords. For more information, please
	<valhallasw>	# see LoginManager.readPassword in login.py.
	<emijrp>	ok, thanks
	<valhallasw>	see config.py for all possible options in user-config.py

backups de base de datos[edit]

28/02/09

first issue: sql-s1 change.  we will shortly be changing s1 from yarrow to
rosemary.  if you have user databases on yarrow, these will *not* be copied
over, and furthermore will be deleted when s3 is re-imported to yarrow.  if you
need to keep these databases, you need to dump them *now* using mysqldump, and
either import them into the new s1 server after the change, or import them back
into yarrow when s3 is reimported.

procesos[edit]

  • pstree emijrp -a

uso de espacio en disco disk usage, quota[edit]

  • du -h
  • du -h 2>/dev/null | sort -rn | head -10 (sin -h no desordena 233K y 100M)
    • arreglado por nessa_los

domas logs[edit]

[11:03:07]	<emijrp>	domas: your visits logs, like pagecounts-20100402-030000.gz, it contains from 02:00:00 to 02:59:00 or from 03:00:00 to 03:59:59 ?
[11:03:50]	<domas>	02:00:00 to 02:59:00
[11:03:58]	<emijrp>	ok, thanks
[11:04:11]	a readme file in the directory would be nice : )

Special:Search mayúsculas, minúsculas[edit]

De includes/search/SearchEngine.php

# Now try all lower case (i.e. first letter capitalized)
#
$title = Title::newFromText( $wgContLang->lc( $term ) );
if ( $title && $title->exists() ) {
	return $title;
}
# Now try capitalized string
#
$title = Title::newFromText( $wgContLang->ucwords( $term ) );
if ( $title && $title->exists() ) {
	return $title;
}

... y algunas más ...

usa ucwords(), ucwordbreaks() [5] y otras...