Merge pull request #1 from oscarmlage/feature/oscar-theme

Feature/oscar theme
remotes/oscarmlage/main
Óscar M. Lage 2022-03-24 10:12:55 +01:00 committed by GitHub
commit eb462f6c61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1943 changed files with 11629 additions and 2148 deletions

View File

@ -6,5 +6,8 @@ build:
serve:
docker-compose -f docker-compose.yml up serve
bash:
docker-compose -f docker-compose.yml exec serve bash
shell:
docker-compose -f docker-compose.yml run build shell

View File

@ -30,6 +30,7 @@ Then the site will be available in `http://localhost:1313`
## Other commands
- `make build`: Builds the static site into `public/` directory
- `make serve`: Launches a server in `http://localhost:1313`
- `make shell`: Enters in the container in order to create new contents, etc....
Once inside the container you can run some other `hugo` commands:
- `hugo new posts/slugified-title`: Create a new post.

38
TODO.md Normal file
View File

@ -0,0 +1,38 @@
# TODO
## For the release
> List of things to do
- [x] Take a look to the li margin-bottom
- [x] About, social section, maybe something similar to the index page could fit better
- [x] Review <link rel="stylesheet" href="{{ "css/fonts.css" | relURL }}"> in metas.html. It´s necessary?
- [x] og + twitter card
- [x] Index, 5 posts
- [x] Archive + About: Change title
- [x] Emphasize `<code>`
- [x] Favicon (Added)
- [x] Review the favicon imgs directory. Not sure if the images are in the right directory.
- [x] Change paginators (no vertical separator |)
- [x] Fonts, use one font for the title and another one (more readable) for the post text
- [x] Remove background pre on about
- [x] Remove `tale` theme
- [ ] Some images contains a `<p>`, get rid of it.
- Images with p in the post content (as it is html now)
- `![image.png](path/to/image.png)` -> `<p><img src=""></p>`
- [ ] There is a `<h2>` that contains a `<p>` too. Try to get rid of it
- `##` -> `<h2><p>Whatever</p></h2>`
- [ ] Review pending texts (off-screen)
- [ ] Index
- [ ] About, Colophon, CV... (add Setup info?)
- [ ] Clean some stuff here and there
## For the future
> List of wanna-have things for the future
- [ ] Give a try to [this font](https://berkeleygraphics.com/typefaces/berkeley-mono)
and take a look to the license
- [ ] Index call2action that leads you to "posts"
- [ ] Different sizes for the images (full-width, mid, normal, narrow...)
- [ ] Import some other posts from other years
- [ ] Support some thing like microposting (as bebu does)

View File

@ -3,14 +3,18 @@ version: "3.1"
services:
build:
image: klakegg/hugo:0.88.0-ext-alpine
# image: klakegg/hugo:0.88.0-ext-alpine
image: oscarmlage/hugo:0.88.0-ext-alpine
volumes:
- "${PWD}/src:/src"
serve:
image: klakegg/hugo:0.88.0-ext-alpine
# image: klakegg/hugo:0.88.0-ext-alpine
image: oscarmlage/hugo:0.88.0-ext-alpine
command: server -vv
volumes:
- "${PWD}/src:/src"
ports:
- 1313:1313
stdin_open: true # -i
tty: true # -t

View File

@ -2,8 +2,6 @@
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
client:
tags: []
stack: []
image:
current: false
---

View File

@ -1,12 +1,18 @@
baseURL: 'https://oscarmlage.com'
languageCode: 'en-us'
title: 'oscarmlage'
theme: 'tale'
theme:
- 'oscar'
- 'hugo-shortcode-gallery'
pygmentsStyle: "monokai"
canonifyurls: true
paginate: 15
paginate: 10
summarylength: 30
timeout: 60000
params:
galleryLoadJQuery: true
defaultContentLanguage: "en"
markup:
@ -22,23 +28,18 @@ permalinks:
menu:
main:
- identifier: "about"
name: "About"
title: "About"
url: "/about/"
weight: 0
- identifier: "posts"
name: "Posts"
title: "Posts"
url: "/posts/"
weight: 10
- identifier: "archive"
name: "Archive"
title: "Archive"
url: "/archive/"
weight: 0
- identifier: "projects"
name: "Projects"
title: "Projects"
url: "/projects/"
weight: 0
- identifier: "colophon"
name: "Colophon"
title: "Colophon"
url: "/colophon/"
weight: 0
weight: 20
- identifier: "about"
name: "About"
title: "About"
url: "/about/"
weight: 30

View File

Before

Width:  |  Height:  |  Size: 597 KiB

After

Width:  |  Height:  |  Size: 597 KiB

View File

@ -0,0 +1,10 @@
---
title: "Hero1"
date: 2022-02-28T22:25:30Z
draft: false
image: anon.png
current: false
---
Este es el primer texto dinámico del hero y mejor con el [enlace a twich aquí](https://twitch.tv/oscarmlage), no global ⚡.

View File

@ -0,0 +1,9 @@
---
title: "Hero2"
date: 2022-02-28T22:25:56Z
draft: true
image:
current: false
---
2. El segundo texto dinámico de nuestro hero particular

View File

@ -0,0 +1,9 @@
---
title: "Hero3"
date: 2022-02-28T22:26:26Z
draft: true
image: anon.png
current: true
---
3. Otro texto más, incluso hasta con foto y para Twitch

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

View File

@ -0,0 +1,9 @@
---
title: "20180117"
date: 2018-01-17T11:15:11Z
draft: false
tags: [ "personal" ]
image: amor-infinito.jpg
---
<p><span style="font-size: 1.5em;">Those we love never truly leave us. There are things that death cannot touch.</span></p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 714 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 861 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 740 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 742 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 539 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 642 KiB

View File

@ -0,0 +1,18 @@
---
title: "5 random things I did this weekend"
date: 2014-12-09T11:33:11Z
draft: false
tags: [ ]
image: 2014-12-07_18.52.37.jpg
---
<p><strong>1.- Had a really nice travel</strong></p>
<p>Most of times day by day, working, and taking care of twins is a hard task to manage, it eats almost all our time and talks are reduced to basics, organize homeworks, meals and not much more. This weekend we have taken advantage of the time while traveling to update ourselves, take a deep breath and go on.</p>
<p><strong>2.- Drumming</strong></p>
<p>Not really. The house where we stayed had a drum, nice toy for our children, so they were drumming most of the time. They really love to make "music"... you can imagine where our heads are today.</p>
<p><strong>3.- Had lovely seashore walks</strong></p>
<p>One of the things I really miss in winter is the sea. It was nice to walk along a seafront and sitting in a beach with the children, just throwing stones to the water and enjoy watching the waves.</p>
<p><strong>4.- Had an Irish coffee with friends</strong></p>
<p>Saturday night, after dinner, we made a kind of irish coffee (coffee + burnt whiskey + cream). I enjoyed both, trying to burn the whiskey, drinking the cocktail and being with friends late in the night.</p>
<p><strong>5.- Disconnect from the world</strong></p>
<p>We have rented a house in the country side, that means internet is almost no available. I've not opened the laptop during the whole weekend, and almost nothing the smartphone. No received calls and no news from the "outside". As we always used to say... we should do it more often.</p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 MiB

View File

@ -0,0 +1,40 @@
---
title: "Almost the perfect music stack"
date: 2018-02-25T21:24:04Z
draft: false
tags: [ ]
image: almost-perfect-music-stack04.jpg
---
<p>I used to be a person that perfecly could live without any music in my daily basics. That changed a lot last years. Now I have some use cases where the music is essential:</p>
<ul>
<li>Developing</li>
<li>Training (it doesn't matter inside or outside)</li>
<li>In the shower</li>
<li>Cooking, traveling...</li>
</ul>
<p>So I had a little problem with the playlists because they are difficult to be synced across multiple devices and different music players. It's a true nightmare if you want to have <em>the same</em>&nbsp;available <em>all the time</em>. But I guess it's posible and... free!.</p>
<p>On the desktop I'm used to play music with <code>cmus</code> - I think I've written <a href="https://www.userlinux.net/music-terminal-cmus-mpsyt.html">about this before</a> - because it's really light and it barely consumes computer resources. Ok, this is the only case where I have to build my playlists manually (or even that, continue reading). I've tried (and I have it installed) the <em>unofficial Google Play Music Desktop Player</em> and it's fine, but, far from being a battery drainer, it's not as tiny as cmus is. Desktop (and laptop) covers the "developing" cases, both, home and coffice.</p>
<p>On the mobile I was using <em>VLC</em> and some other players but in the end it was a waste of time to have to sync all the music all the time, update the playlists, etc... so in the end I decided to give a try to <em>Google Play Music</em>. As I was using it from time to time (the unofficial one) in Desktop, I have all the music there, so I can <em>download</em> to the phone the playlists I want to listen while I'm <em>offline</em>. That's perfect. The mobile covers all the other cases (training, shower, in the kitchen...) but the car (that's another history).</p>
<p><strong>In brief:</strong></p>
<ul>
<li>All the music is in my <code>Music/</code> folder, organized by folders, those folders are my local <em>playlists</em> because in cmus I treat the folders like playlists.</li>
<li>The Google Play Music watches the <code>Music/</code> folder and uploads automatically all the songs that appears in any subfolder there (you need the <a href="https://play.google.com/music/listen?u=0#/manager">Music Manager</a> installed in your computer).</li>
<li>I have to tag the songs in it's playlists once they're uploaded to <em>Google Play Music</em> and that's it.</li>
<li>Extra step: I can download the playlists just in <em>1-click</em> from the mobile if I run out of data connection.</li>
<li>Extra step 2: If the <code>Music/</code> folder is synced via <code>Owncloud</code>/<code>Nextcloud</code> the music is available even across many other devices too.</li>
</ul>
<p><strong>PROS:</strong></p>
<ul>
<li>This stack is free, well, limited to 50.000 songs (by <em>Google Play</em>) but that's, by far, as free for me.</li>
<li>On the other hand, the left one to be more specific :D, I have the <a href="https://www.userlinux.net/set-garmin-vivoactive-hr-notifications-telegram.html">Garmin Vivoactive HR</a>, and there is a widget to control the Music Player of the smartphone, it runs really nice with the <em>Google Play</em> software, so with this extra feature, the stack is almost perfect for me.</li>
</ul>
<p><strong>CONS:</strong></p>
<ul>
<li>I have to think twice which folder fits best for every song in my <code>Music/</code> local storage.</li>
<li>I have no automatic/automagic solution for the car. I need to manually sync the <code>Music/</code> folder to the USB drive I'm using there. Or just connect the smartphone to the AUX IN and see what happens (never tried, that thought just occurred to me as I write).</li>
</ul>
{{< gallery match="gallery/*" sortOrder="asc" rowHeight="150" margins="5" thumbnailResizeOptions="600x600 q90 Lanczos" previewType="blur" embedPreview="true" >}}
<p>And I think that's all folks, how do you manage with this? Feedback is always welcome.</p>

View File

@ -0,0 +1,128 @@
---
title: "Ampliación de una partición, VPS de OVH"
date: 2016-04-20T08:21:14Z
draft: false
tags: [ "sysadmin" ]
image: vpsovh.jpg
---
<p>Gran invento los VPS de OVH, excepcional rendimiento a precio inigualable y ahora que han activado el servicio de <em>snapshots</em> no se puede pedir m&aacute;s por <em>3&euro;/mes</em>. Pero como no me llevo comisi&oacute;n, vamos al l&iacute;o t&eacute;cnico. Lo has empezado a usar, te ha molado y ahora el disco duro se te queda peque&ntilde;o (<em>10Gb</em> por defecto) as&iacute; que decides cambiar el tipo de servidor a otro con m&aacute;s disco... pero los cambios no se aplican autom&aacute;gicamente como en otras veces... as&iacute; que vamos a intentar arreglarlo.</p>
<p>Lo primero es entrar en la m&aacute;quina, ver el esquema de particionado y anotar alg&uacute;n que otro valor que nos va a ayudar m&aacute;s adelante:</p>
```
# mount
/dev/vda1 on / type ext4 (rw)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
```
```
# cat /etc/fstab
LABEL=cloudimg-rootfs / ext4 defaults 0 0
```
```
# df -h
Filesystem Size Used Avail Use% Mounted on
udev 1.9G 4.0K 1.9G 1% /dev
tmpfs 386M 892K 385M 1% /run
/dev/vda1 9.9G 7.5G 2.0G 80% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
none 5.0M 0 5.0M 0% /run/lock
none 1.9G 12K 1.9G 1% /run/shm
none 100M 0 100M 0% /run/user
```
```
# fdisk /dev/vda
Command (m for help): p
Disk /dev/vda: 21.5 GB, 21474836480 bytes
4 heads, 32 sectors/track, 327680 cylinders, total 41943040 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0005bac1
Device Boot Start End Blocks Id System
/dev/vda1 * 2048 20971519 10484736 83 Linux
```
<p>Anotamos los siguientes valores:</p>
<ul>
<li>Sector comienzo de la partici&oacute;n:&nbsp;<strong>2048</strong></li>
<li>Tama&ntilde;o usado de la partici&oacute;n:&nbsp;<strong>7.5Gb</strong></li>
<li>Tama&ntilde;o total del disco:&nbsp;<strong>21.5G</strong></li>
</ul>
<p>Como se puede ver, ya tenemos el nuevo disco (<em>20Gb</em>) en funcionamiento, pero las particiones todav&iacute;a est&aacute;n ancladas al anterior.&nbsp;Una vez anotados todos estos valores y teniendo a buen recaudo el resto de la informaci&oacute;n, tenemos que eliminar el sistema de particionado actual (<strong>d</strong>), comprobar que se ha eliminado -en este caso la &uacute;nica partici&oacute;n que hab&iacute;a- (<strong>p</strong>), recreamos el sistema de particiones (<strong>n</strong>) con el nuevo tama&ntilde;o y reescribimos la tabla de particiones (<strong>w</strong>). Todo esto usando <code>fdisk</code> en modo <code>live</code>, nada de <code>rescue</code> que por algo somos gallegos:</p>
```
# fdisk -u /dev/vda
Command (m for help): d
Selected partition 1
Command (m for help): p
Device Boot Start End Blocks Id System
Command (m for help): n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-41943039, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-41943039, default 41943039):
Using default value 41943039
Command (m for help): p
Device Boot Start End Blocks Id System
/dev/vda1 2048 41943039 20970496 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
```
<p>Por defecto ya nos ha cogido los valores buenos al crear la nueva partici&oacute;n (<strong>2048</strong> como sector de inicio y <strong>41943039</strong> como sector de fin), si nos fijamos el sector final es pr&aacute;cticamente el doble del que ten&iacute;amos anteriormente (<em>20971519</em>), porque el nuevo disco es de <em>20Gb</em> en lugar de <em>10Gb</em>. Si no cogiera los valores por defecto tendr&iacute;amos que introducirlos manualmente.</p>
<p>Reiniciamos el vps y una vez haya reiniciado entramos de nuevo para redimensionar la nueva partici&oacute;n al tama&ntilde;o correspondiente:</p>
```
# df -h | grep vda1
/dev/vda1 9.9G 7.5G 2.0G 80% /
```
```
# resize2fs /dev/vda1
```
```
# df -h | grep vda1
/dev/vda1 20G 7.5G 12G 40% /
```
<p>Como se puede comprobar, ya tenemos la partici&oacute;n lista con su nuevo tama&ntilde;o. Al final ha sido m&aacute;s f&aacute;cil y menos traum&aacute;tico de lo esperado.</p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 319 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 456 KiB

View File

@ -0,0 +1,20 @@
---
title: "BASH, PS1 and the long commands"
date: 2018-08-07T11:17:04Z
draft: false
tags: [ ]
image: bash-ps1-and-long-commands00.jpg
---
<p>Had a strange behavior in my bash while browsing the command history. I'm always traveling in time with the <code>&lt;Up&gt;</code> arrow in my bash, but when a long command (longer than<em> $COLUMNS</em>) is being loaded, the prompt (<em>$PS1</em>) dissapears and it starts to behave as hell:</p>
<p><img style="width: 100%; height: auto;" src="gallery/bash-ps1-and-long-commands-01.gif" alt="" /></p>
<p>After some reserach here and there, as usual, <a href="https://unix.stackexchange.com/a/105974">StackOverflow gave me the answer</a>: the unenclosed non-printable character sequences:</p>
<p><img style="width: 100%; height: auto;" src="gallery/bash-ps1-and-long-commands-02.gif" alt="" /></p>
<p>In my case it was exactly like that:</p>
```sh
export PS1="033[1;30m]&raquo; [e[0;33m]mbp033[1;30m]╺─╸[033[1;30m][[033[0m]W[033[1;30m]][033[1;34m]:[033[0m] "
export PS1="[033[1;30m]&raquo; [e[0;33m]mbp[033[1;30m]╺─╸[033[1;30m][[033[0m]W[033[1;30m]][033[1;34m]:[033[0m] "
```
<p>Could you spot the difference?. Please ensure all your non-printable sequences are enclosed in <code>[</code> and <code>]</code> in your prompt before complain about bash doing weird things.</p>

View File

@ -0,0 +1,32 @@
---
title: "Bucles asíncronos en javascript"
date: 2019-06-20T17:26:24Z
draft: false
tags: [ ]
image: vuedotjs.jpg
---
<p>Muchas veces hay ciertas situaciones que hacen que me plantee si esto de programar es para m&iacute;, sobre todo cuando, despues de un <em>debug</em> largo y tedioso, te das cuenta que lo que pasaba o era una chorrada o fallo m&iacute;o por no conocer los internals del lenguaje correspondiente.</p>
<p>Quiero pensar que en mayor o menor medida le pasa alguna vez a todo el mundo.</p>
<p>En este caso he perdido las yemas de los dedos de tanto <code>console.log</code> que creo que podr&iacute;a ir a por el r&eacute;cord Guinness. En la l&oacute;gica de un compoenente <a href="https://vuejs.org/">Vue</a> al que me ha tocado meterle mano hay una situaci&oacute;n un tanto graciosa. Tengo que hacer varias llamadas <em>AJAX</em> en el m&eacute;todo <code>mounted()</code> para recoger datos de un <em>API</em>.</p>
<p>Nada fuera de lo com&uacute;n. Digamos que tengo un id de competici&oacute;n y tengo que llamar a un endpoint en el que que, dado ese id, me devuelve el nombre de la competici&oacute;n. Una vez conozco el nombre, tengo que llamar a otro endpoint que me devuelva un listado de rondas que tiene esa competici&oacute;n. Y por &uacute;ltimo, dado ese listado de rondas, hacer una tercera llamada que, por cada ronda, me facilite el listado de deportistas que van a competir.</p>
<p>Tengo que definir el m&eacute;todo como as&iacute;ncrono para poder hacer que unas peticiones esperen por el resultado de la anterior, hasta donde he le&iacute;do ning&uacute;n problema por definir <code>async mounted()</code> y jugar con <code>await</code> y <code>Promises</code>, pero &iquest;qu&eacute; opin&aacute;is de esa tercera llamada en bucle?.</p>
<p>Entiendo que si dentro del bucle <code>forEach</code> de rounds defino el m&eacute;todo como as&iacute;ncrono podr&eacute; hacer las llamadas correspondientes esperando su ejecuci&oacute;n con <code>await</code>, tal que as&iacute;:</p>
```js
Array.from(this.rounds).forEach( async round =&gt; {
await this.get_competitors_list(round.round_id);
[...]
});
```
<p>Error, <code>forEach</code> no va a esperar a que hayan acabado los elementos marcados como tal, simplemente ejecuta y sigue. As&iacute; que, leyendo un poco de <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols">Iteration protocols</a> veo que en su lugar podemos usar <code>for..of</code>, que es una versi&oacute;n moderna del "for loop" de forma que, simplemente cambiando forEach y adaptando la sintaxis al nuevo bucle haremos que funcione adecuadamente:</p>
```js
for(let round of this.rounds) {
await this.get_competitors_list(round.round_id);
[...]
}
```
<p>Y eso es todo, ni m&aacute;s ni menos; una tarde entera de debug y seguir trazas aqu&iacute; y all&aacute;. Todo muy gracioso y divertido.</p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

View File

@ -0,0 +1,51 @@
---
title: "Call date inside an alias"
date: 2015-07-02T21:03:20Z
draft: false
tags: [ ]
image: alias.jpg
---
<p>Stupidity of the day: calculate the <code>date</code> in an double quoted bash <code>alias</code>. It seems that, if you don't escape the <code>date</code> call, it's called at the time of the <code>alias</code> definition, so it's not the real behaviour I was looking for:</p>
```
$ date +%Y%m_%H%M
201507_2252
$ alias foo="echo `date +%Y%m_%H%M`"
$ foo
201507_2252
```
<p>Wait a minute and...</p>
```
$ date +%Y%m_%H%M
201507_2253
$ foo
201507_2252
```
<p>Not really usable when you want the date at the time you run the alias, not when it's defined, so you have to escape the date call this way:</p>
```
$ date +%Y%m_%H%M
201507_2253
$ alias foo="echo `date +%Y%m_%H%M`"
$ foo
201507_2253
```
<p>Wait a minute, or a couple of minutes and...</p>
```
$ foo
201507_2255
```
<p>That's all, stupid but so useful trick when you want to define something like:</p>
```
alias test_cov="py.test -s --tb=native --cov proj --cov-report term-missing | tee logs/proj-`date +%Y%m_%H%M`.log"
```
<p>Enjoy!</p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -0,0 +1,111 @@
---
title: "Casual fun with tests"
date: 2015-05-13T18:17:15Z
draft: false
tags: [ ]
image: PhantomJS.png
---
<p>Fun is not the word because I went to bed really annoyed last two days, but it's the only way I can handle this, having as much "fun" as I can.</p>
<p>In one of my projects we are using <a href="http://pytest.org/latest/">py.test</a> + <a href="http://splinter.readthedocs.org/en/latest/">splinter</a> + <a href="http://www.seleniumhq.org/">selenium</a> + (<a href="http://phantomjs.org/">phantomjs</a>|<a href="https://sites.google.com/a/chromium.org/chromedriver/">chromedriver</a>) for headless testing. It's a good combination when it works, but the question is that rarely does in my enviroment.</p>
<p>Don't know whose fault, first times I've pointed to <em>chromedriver</em> (tried many versions), then I've changed to <em>phantomjs</em> and crashes were still there. Tried <em>phantomjs</em> downloaded binary from oficial web, other one from <em>npm</em>, even tried building my own binary!. Then I've changed the <em>selenium</em> version (<em>2.45.0</em>, <em>2.44.0</em>, <em>2.43.0</em>...), <em>splinter</em> (from <em>0.6.0</em> to <em>0.7.2</em>), I've tried rebuilding the enviroment from scratch, increasing OS limits... but nothing seemed to work.</p>
```
PhantomJS:
...
project/tests/test_integration/headless_1.py ....
project/tests/test_integration/headless_2.py ...............
project/tests/test_integration/headless_3.py .
project/tests/test_integration/headless_4.py ..........
project/tests/test_integration/headless_5.py .....................................
project/tests/test_integration/headless_6.py ...............
project/tests/test_integration/headless_7.py ........
project/tests/test_integration/headless_8.py .......
project/tests/test_integration/headless_9.py ....
project/tests/test_integration/headless_10.py ..
project/tests/test_integration/headless_11.py ....
project/tests/test_integration/headless_12.py .........
project/tests/test_integration/headless_13.py ...........
project/tests/test_integration/headless_14.py ............FFF
project/tests/test_integration/headless_15.py FFFFFFFFFFFFFFFFFFFFFFFF
File ".../lib/python2.7/site-packages/selenium/webdriver/phantomjs/service.py",
line 75, in start raise WebDriverException("Unable to start phantomjs with ghostdriver.", e)
WebDriverException: Message: Unable to start phantomjs with ghostdriver.
Screenshot: available via screen
================================ 28 failed, 1809 passed, 2 skipped in 1825.82 seconds ================================
ChromeDriver:
...
project/tests/test_integration/headless_1.py ....
project/tests/test_integration/headless_2.py ...............
project/tests/test_integration/headless_3.py .
project/tests/test_integration/headless_4.py ................................
project/tests/test_integration/headless_5.py ...............
project/tests/test_integration/headless_6.py ........
project/tests/test_integration/headless_7.py .......
project/tests/test_integration/headless_8.py ..FF
project/tests/test_integration/headless_9.py FF
project/tests/test_integration/headless_10.py FFFF
project/tests/test_integration/headless_11.py FFFFFFFFF
project/tests/test_integration/headless_12.py FFFFFFFFFFF
project/tests/test_integration/headless_13.py FFFFFFFFFFFFFFF
project/tests/test_integration/headless_14.py FFFFFFFFFFFFFFFFFFFFFFFF
File ".../lib/python2.7/site-packages/selenium/webdriver/chrome/service.py",
line 70, in start http://code.google.com/p/selenium/wiki/ChromeDriver")
WebDriverException: Message: 'chromedriver' executable needs to be available in the path.
Please look at http://docs.seleniumhq.org/download/#thirdPartyDrivers and read up at
http://code.google.com/p/selenium/wiki/ChromeDriver
================================ 67 failed, 1770 passed, 2 skipped in 1182.77 seconds ================================
$ phantomjs -v
1.9.8
(tested with 1.9.8 downloaded binary, from npm and built one)
$ chromedriver -v
ChromeDriver 2.15.322455 (ae8db840dac8d0c453355d3d922c91adfb61df8f)
$ pip freeze
selenium==2.45.0
splinter==0.7.2
Python 2.7.6 (default, Nov 12 2013, 13:26:39)
$ ulimit
unlimited
$ sysctl -a | grep maxfil
kern.maxfiles = 12288
kern.maxfilesperproc = 10240
kern.maxfiles: 12288
kern.maxfilesperproc: 10240
$ sudo sysctl -w kern.maxfiles=65536
$ sudo sysctl -w kern.maxfilesperproc=65536
$ sysctl -a | grep maxfil
kern.maxfiles = 65536
kern.maxfilesperproc = 65536
kern.maxfiles: 65536
kern.maxfilesperproc: 65536
$ launchctl limit maxfiles
maxfiles 256 unlimited
$ launchctl limit maxproc
maxproc 709 1064
```
<p>Integration tests starts working great, but suddenly "it" starts to crash and once it crashes first time, I only get <code>F</code> til the end. I've opened a <a href="https://github.com/cobrateam/splinter/issues/400">issue in splinter github project</a>, I've asked in <em>#phantomjs</em>&nbsp;freenode irc channel but there are no clues about that strange behaviour. It exceeds my patience.</p>
<p>Casually one of my fellows said something about running tests slightly faster with multiprocessing option (<code>-n</code>) and once we tested it - just curiosity - we realized that tests were not failing in same way, moreover, they were finally passing!. Speed is not the key, because the improvement is not that much, but who cares... test are passing!!.</p>
```
$ py.test -s --tb=native --cov project --cov-report term-missing -n 2
```
<p>In the end we don't know what's happening with our enviroments, don't know who's fault, but we find a temporary solution in a stupid an casual way. "Fun".</p>

View File

@ -0,0 +1,23 @@
---
title: "copy-paste mode in tmux 2.4"
date: 2017-05-25T10:47:12Z
draft: false
tags: [ ]
image: tmux-iterm.png
---
<p>Some changes has happened in the last version of <a href="https://tmux.github.io/">tmux</a>. Suddenly the <em>copy-paste </em>&nbsp;was not running but had no time to research the reason until minutes ago:</p>
```
bind-key -Tcopy-mode-vi Escape cancel
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
bind-key -Tcopy-mode-vi 'V' send -X select-line
bind-key -Tcopy-mode-vi 'y' send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
bind-key p paste-buffer
unbind -Tcopy-mode-vi Enter
bind-key -Tcopy-mode-vi Enter send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
bind-key -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
```
<p>There are a couple of issues (<a href="https://github.com/tmux/tmux/issues/592">#592</a>, <a href="https://github.com/gpakosz/.tmux/issues/42">#42</a>) related. Glad this amazing feature is back again.</p>
<p><iframe src="https://www.youtube.com/embed/ho4355YKf4Y" width="100%" height="420"></iframe></p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 647 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View File

@ -0,0 +1,17 @@
---
title: "Cowlab 3: package managers"
date: 2018-03-03T16:15:20Z
draft: false
tags: [ ]
image: IMG_20180302_214903.jpg
---
<p>Yesterday night we had the 3rd meeting of our "<em>cowlab</em>". <a href="https://cowlab-lugo.github.io/">Cowlab</a> is a movement we started here in Lugo to keep in touch and organize some kind of events related with technology: it is a dynamic community with ideas inspired by the <em>Open Source</em> philosophy.</p>
<p>In this third edition three of us had agreed to make a talk about package managers in some of the most popular programming languages. <a href="http://nosolosoftware.com/">Andr&eacute;s</a> did the <em>Javascript</em> part talking about <code>npm</code>, <a href="https://www.dieg0v.com/">Diego</a> the <em>PHP</em> part with <code>composer</code> and I defended <em>Python</em> with <code>pip</code>.</p>
<p>I would like to thank <em>Andr&eacute;s</em> and <em>Diego</em> for the great stuff they created and all the fun we had during the preparation. Thanks to the attendants and a special mention to <a href="http://makerslugo.org/">makers.lugo</a> because they let us borrow the place to make this happen.</p>
<p>We have managed to publish all the stuff (slides, projects and some other surprise) in <a href="https://github.com/cowlab-lugo/packages">the official cowlab repo</a>. Feel free to use, share or distribute whatever you want there.</p>
<p>And, of course, I can not close this post without the photos.</p>
{{< gallery match="gallery/*" sortOrder="asc" rowHeight="150" margins="5" thumbnailResizeOptions="600x600 q90 Lanczos" previewType="blur" embedPreview="true" >}}
<p>Thank you so much, see you at cowlab #4!.</p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -0,0 +1,30 @@
---
title: "Cron: variables based on command output"
date: 2015-09-18T08:13:29Z
draft: false
tags: [ "sysadmin" ]
image: 41996742bd0a8110686906487cc1090a.jpg
---
<p>I had a problem with a cron job, a not-so-annoying but daily-repeating one. It's like a drill boring your mind slowly. Every time I got an email with the failing report the drill bit made more internal damage.</p>
```
/bin/sh: -c: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1 systax error: unexpected end of file
```
<p>I was just trying to put a date into a file's name to backup a <a href="http://spamassassin.apache.org/">SpamAssassin</a> bayes database, something like <code>bayes-201508</code>, but it seemed that it didn't like to cron. I've tried it many ways:</p>
```
30 * * * * /usr/bin/sa-learn --backup &gt; /data/bayes-$(date +%Y%m).back
30 * * * * /usr/bin/sa-learn --backup &gt; /data/bayes-$(date '+%Y%m').back
30 * * * * /bin/bash -l -c '/usr/bin/sa-learn --backup &gt; /data/bayes-$(date +%Y%m).back'
```
<p>Thought it was caused to crontabs being running with <em>sh</em> instead of <em>bash</em> but at last nothing seemed to work in the proper way. I've experienced similar problems other times so I've decided to write the solution here: just escape the date call arguments:</p>
```
30 * * * * /usr/bin/sa-learn --backup &gt; /data/bayes-$(date +%Y%m).back
```
<p>And it will work like a charm. Hope this helps in the future.</p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -0,0 +1,32 @@
---
title: "Darcs: Fixing a wrong amend"
date: 2015-10-30T10:58:24Z
draft: false
tags: [ "code" ]
image: darcs-fixing-wrong-amend.jpeg
---
<p>I must admit I often get confused when recording a new patch based on a previous one. Sometimes I <code>amend</code> instead of creating a new record, and once it's done it's not easy to <em>rollback</em>. Well, really it is if you have a backup of the original patch. And this is how I treated to handle it...</p>
<p><img style="display: block; margin-left: auto; margin-right: auto; width: 100%; height: 100%;" src="gallery/darcs-fixing-wrong-amend.png" alt="" /></p>
<p>First of all, having blundered with the amend, make a repository backup on disk. Once it's done the process should be:</p>
<ul>
<li>Amend other changes to that wrong patch, no matter really, we're going to unpull the patch in next step.</li>
<li>Unpull the patch with the wrong amend.</li>
<li>Pull the original patch (remember, we should have a copy of the original patch -<em>before the wrong amend</em>- to restore it).</li>
<li>Synchronize the repo backup copy to the current one excluding <code>_darcs</code> metadata directory.</li>
</ul>
```
$ cp -r myrepo myrepo.back
$ cd myrepo
$ darcs amend file1 file2
* patch X
$ darcs unpull
* patch X
Shall I unpull this patch? (1/1): y
$ dars apply patch-X-original.dpatch
$ cd ..
$ rsync -lprtvvzog --exclude '_darcs' myrepo.back/ myrepo/
```
<p>Now your repo should be exactly as before to make the wrong amend. Once again, the power of the backups is priceless.</p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -0,0 +1,35 @@
---
title: "Darcs: otra forma de trabajar"
date: 2013-01-11T17:18:13Z
draft: false
tags: [ "code" ]
image:
---
<p>Si tengo que ser sincero, desde un principio he sido bastante reacio a la moda esta de los sistemas de control de versiones. Estaba tan agusto y acomodado con mis copias de seguridad y mis carpetas <em>fechadas</em> que me daba una pereza enorme ponerme a aprender un nuevo sistema que, sin duda, me obligar&iacute;a a cambiar la forma de trabajar.</p>
<p>La verdad, uno no sabe lo que se est&aacute; perdiendo hasta que lo prueba y aprende. Primero y muy vagamente <a href="http://cvs.nongnu.org/">CVS</a>, luego <a href="http://subversion.tigris.org/">Subversion</a> y posteriormente el gran salto de calidad pasando a los sistemas de control de versiones distribuidos. Me he quedado con el m&aacute;s vers&aacute;til dada mi forma de trabajar: <a href="http://mercurial.selenic.com/">Mercurial</a>.</p>
<p>Pero si algo he aprendido desde esa acomodada posici&oacute;n inicial es a no cerrar posibilidades, as&iacute; que gracias a un proyecto en el que estoy trabajando, he tenido la oportunidad de probar <a href="http://darcs.net/">Darcs</a>, eso si,&nbsp;a otro nivel.</p>
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="gallery/>Y digo "a otro nivel" puesto que la forma de trabajar es m&aacute;s parecida a un proyecto <em>open source</em>&nbsp;en el que hay un <em>core team </em>que verifica y valida el trabajo del resto de la comunidad, pasando el c&oacute;digo un control de calidad previo y una fant&aacute;stica capa de&nbsp;testeo antes de su puesta en producci&oacute;n.&nbsp;El flujo ser&iacute;a el siguiente:</p>
<ul>
<li>Pull de las &uacute;ltimas novedades del proyecto</li>
<li>Se trabaja en las nueva caracter&iacute;sticas</li>
<li>Se "graban" los cambios peri&oacute;dicamente</li>
<li>Cuando varias de esas grabaciones completan una caracter&iacute;stica se crea un parche con todas esas grabaciones y se env&iacute;a al <em>maintainer</em>.</li>
<li>El <em>maintainer</em> verifica la validez - o no - del c&oacute;digo y tiene la capacidad para hacer push.</li>
<li>Dado el caso, se dispara un despliegue a preproducci&oacute;n o a producci&oacute;n directamente.</li>
</ul>
```
$ darcs pull
$ darcs whatsnew -l # muestra status
$ darcs record # hacer commit
$ darcs send -O # crear patch
$ darcs amend
$ darcs push
$ darcs apply parche.patch
$ darcs unpull
```
<p>Como v&eacute;is las &oacute;rdenes son id&eacute;nticas a cualquier otro sistema de control de versiones, de hecho podr&iacute;amos trabajar de forma id&eacute;ntica a como lo hacemos habitualmente con <em>Mercurial</em> o <a href="http://git-scm.com/">Git</a>, (<em>pull</em>, <em>commit</em>, <em>push</em>, etc...) sin embargo est&aacute; resultando una experiencia muy enriquecedora el tener otro flujo distinto al habitual.</p>
<p>En concreto hay una caracter&iacute;stica que me encanta de <em>Darcs</em>, y es el poder <em>commitear</em> partes de un archivo y no el archivo completo. Por ejemplo si hacemos dos cambios distintos en el mismo fichero, uno de ellos corrigiendo un bug y otro porque vamos a empezar una nueva <em>feature</em>, podemos hacer <em>record</em> (<em>commit)</em> del cambio que nos interese, no tiene por qu&eacute; reflejarse el archivo por completo. Algo que en mercurial por ejemplo no se puede hacer a no ser que se active la <a href="http://mercurial.selenic.com/wiki/RecordExtension">extensi&oacute;n record</a>.</p>
<p>Reconozco que todav&iacute;a me falta entrar en detalle con <em>Git</em>, pero al final todos los sistemas de control de versiones que he probado han acabado por gustarme de una u otra forma. As&iacute; que la moraleja ser&iacute;a sencilla, no comentas el mismo error que en un principio he cometido yo, prueba los que puedas y qu&eacute;date con el que m&aacute;s te guste, pero si desarrollas, dcvs es un <em>musthave</em>.</p>

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 309 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 175 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 344 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 269 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 215 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 247 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

View File

@ -0,0 +1,30 @@
---
title: "Digital Nomad: summer basics, 2017"
date: 2017-08-14T12:04:24Z
draft: false
tags: [ "personal" ]
image: digital-nomad-summber-basics-2017.jpg
---
<p>Most of us, people that works on digital services (<em>developers</em>, <em>sysadmins</em>, <em>devops</em>...), have a great privilege: work remotely. And I say "<em>most</em>" because not everyone is allowed to that way of work. For me it's like a dream come true.</p>
<p>To be honest, I'm working from remote most of the time because all the friends and mates we're working with are around the world, but the ability to move myself with the family in summer makes the year much much better.</p>
<p>The other years I've "<em>implemented</em>" this "<strong>summer digital nomad</strong>" stuff I've thought that <a href="../../../../work-anywhere.html">just carrying the laptop on was good enough</a> but, somehow, I was wrong. In fact you will probably need some other gadgets too. These are my basic things:</p>
<ul>
<li><strong>Laptop</strong>, of course, you just can't work without it, it's the main piece of this puzzle.</li>
<li><strong>MiFi + Data Plan</strong>. MiFi is the gadget that shares the 3G/4G with your laptop mostly v&iacute;a WIFI. You should find a good data plan that fits your needs. Last year I've took, IIRC, 3Gb/month and it was not enough. This year I took 25Gb and it was too much (I've consumed the 48% approx), so, in fact, it depends on you.</li>
<li><strong>External hard drive</strong> for backups. Shit happens, and usually it happens when you least expect it so, just pick up an external usb drive and run the backups daily, it doesn't require much effort and it can save you the day (or the holidays).</li>
<li>A bunch of different <strong>wires and adapters</strong>. As you're not in your usual environment you should think about your requirements. If you need some kind of SD/microSD adaptor, some special wires, ethernet, usba-usbc, headphones, hdmi...</li>
<li>The <strong>Smartphone</strong> (or a normal phone). Maybe you need to talk from time to time with your customers. I assume that everyone is carrying a phone but think about a SIP/VoIP client, instant messaging, email client... in some cases a message or an image is better than a call :)</li>
<li><strong>Moleskine + pen</strong>, analogic work also worth it on vacation. Particularly these elements are very important in my holidays because my mind seems to be working on background while the fun happens, so it's good to have them around to write down the good ideas that, unexpectedly, come up.</li>
<li><strong>An external mouse</strong>. I'm not a mouse fan, but I must admit it's better to have one close to you for certain tasks. Up to you.</li>
<li><strong>A schedule</strong>. Do not torture yourself, it's summer and there are lots of fun things waiting for you out there. Organize your time, get the shit done and just have fun!.</li>
</ul>
<p>And as extra...</p>
<ul>
<li><strong>Some books</strong> to read. Appart from the fun and the work, give to your mind something interesting according your flavors. This time I've choosen techie stuff, "Practical Vim" and "Tmux, Productive mouse-free development". <em>Perfecto</em>!.</li>
<li><strong>ChromeCast, Arduino, Raspberry</strong>... Nobody wants to lose the track of your favorite TV series, or just play some retro-games if the weather is not good enough, keep in mind. This year I've forgotten them at home but luckily the weather didn't fail.</li>
</ul>
<p>In short, this is what works for me, probably your basic requirements are different, but remember, if you can work from remote, just do it, enjoy it and have looots of fun. The summer is <strong>too short</strong>.</p>
{{< gallery match="gallery/*" sortOrder="asc" rowHeight="150" margins="5" thumbnailResizeOptions="600x600 q90 Lanczos" previewType="blur" embedPreview="true" >}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Some files were not shown because too many files have changed in this diff Show More