Update: Some posts has now hilighted code

feature/oscar-theme
Óscar M. Lage 2022-03-07 23:06:37 +01:00
parent 2ecdd688ea
commit d7a33df68a
8 changed files with 26 additions and 26 deletions

View File

@ -12,7 +12,7 @@ image: bash-ps1-and-long-commands00.jpg
<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] "
```

View File

@ -13,7 +13,7 @@ image: vuedotjs.jpg
<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);
[...]
@ -22,7 +22,7 @@ Array.from(this.rounds).forEach( async round =&gt; {
<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);
[...]

View File

@ -12,7 +12,7 @@ image: docker-all-the-things.jpg
<p>Este 2019 ha venido con m&uacute;ltiples sorpresas a nivel laboral, variopintos proyectos, cada uno con su stack y sus requisitos distintos. Diferentes lenguajes de programaci&oacute;n, diferentes maneras de guardar los datos pero todos ellos con un denominador com&uacute;n: una carretilla llena de problemas a la hora de montar el entorno de desarrollo.</p>
<p>Tengo proyectos con <code>MySQL-5.5</code>, con <code>MySQL-5.7</code>, <code>MariaDB-10.1.32</code>, <code>AuroraDB</code>, <code>Python-2.7</code>, <code>Python-3.6.5</code>, <code>Django</code>, <code>Flask</code>, <code>FalconFramework</code>, <code>Zappa</code>, <code>PHP-5.6</code>, <code>PHP-7.*</code>, <code>CodeIgniter</code>, <code>Laravel</code>, <code>Apache2.2</code>, <code>Apache2.4</code>, <code>Nginx</code>, <code>Jasper Reports</code>... Imaginaos por un momento que no exista ning&uacute;n tipo de soluci&oacute;n de virtualizaci&oacute;n barra containers barra whatever. &iexcl;La que se podr&iacute;a haber liado para montar todo esto!. El ejemplo m&aacute;s llamativo de los &uacute;ltimos d&iacute;as ha sido la dependencia de un <code>Jasper Server</code>, con todo su <code>JAVA</code>,&nbsp;<code>Tomcat</code>&nbsp;y dem&aacute;s dolores de cabeza... Y por otro lado tendr&iacute;amos algo tal que as&iacute;:</p>
```
```sh
$ docker pull bitnami/bitnami-docker-jasperreports
$ vim docker-compose.yml
...

View File

@ -12,13 +12,13 @@ image: irssi-hilighting-your-nick.jpg
<p>What was the problem then? It seems that irssi was highlighting only when someone mentioned me at the beginning of the phrase like this&nbsp;<code>r0sk:&nbsp;</code>but it wasn't doing it in a normal nick mention in the middle of a sentence like <code>hey r0sk sup there!?</code> or similar.</p>
<p>I knew that something like this could be configured so reading a bit about <a href="https://irssi.org/documentation/help/hilight/">irssi hilight</a> found the way to be alerted even if they are shouting <code>r000ssskkk!!</code> to me, the solution can be applied in two ways, in the irssi command line:</p>
```
```sh
/hilight -regexp r0+s+k+
```
<p>And, of course, in the <code>.irssi/config</code> file, because if you have put it in the command line and the setting is not saved to the config file, it won't work in case of restart:</p>
```
```python
hilights = (
{ text = "r0+s+k+"; nick = "yes"; word = "yes"; regexp = "yes"; }
)

View File

@ -10,7 +10,7 @@ image: letsencrypt.png
<p>In my case I've a <em>Debian7</em> using and comsuming some <abbr title="Lets Encrypt">LE</abbr> certs in both ways so I woke up this morning with the smell of alert in the atmosphere. After reading some literature&nbsp;<a href="https://scotthelme.co.uk/lets-encrypt-old-root-expiration/">here</a> and <a href="https://letsencrypt.org/certificates/">there</a> and talked about it with some mates, decided to manually update the certificate. I was forced to proceed in that way because the package updates for <code>deb7</code><span> are totally out of date (or even closed I'd say).</span></p>
<p>We can see the error here:</p>
```
```bash
$ openssl s_client -host oscarmlage.com -port 443 -showcerts
CONNECTED(00000003)
depth=2 C = US, O = Internet Security Research Group, CN = ISRG Root X1
@ -28,13 +28,13 @@ verify return:0
</ul>
<p>Now that we already have them handy, we need to copy the good one, remove the older other in the affected machine and refresh the certificates:</p>
```
```bash
$ scp user@newerhost:/usr/share/ca-certificates/mozilla/ISRG_Root_X1.crt /usr/share/ca-certificates/mozilla/
$ mv /usr/share/ca-certificates/mozilla/DST_Root_CA_X3.crt /tmp/
```
```
```bash
$ echo "/usr/share/ca-certificates/mozilla/ISRG_Root_X1.crt" &gt;&gt; /etc/ca-certificates.conf
$ vim /etc/ca-certificates.conf
# remove the /usr/share/ca-certificates/mozilla/DST_Root_CA_X3.crt line
@ -46,7 +46,7 @@ Running hooks in /etc/ca-certificates/update.d....done.
<p>And we can test if it works now:</p>
```
```bash
$ openssl s_client -host oscarmlage.com -port 443 -showcerts
CONNECTED(00000003)
depth=2 C = US, O = Internet Security Research Group, CN = ISRG Root X1

View File

@ -31,7 +31,7 @@ image: mattermost-matterbridge.JPG
<p><strong>Install a Mattermost server</strong></p>
<p>As slackers, laziness is the strength that moves us so we are going to use docker for both (mattermost and matterbridge) directly in command line (we should prepare our database before, I told you I was old-school so I don't go for a db-container this time):</p>
```
```bash
docker run -d
-p 8000:8000
-e MM_SERVICESETTINGS_SITEURL="&lt;https://mymattermost.domain.com&gt;"
@ -54,7 +54,7 @@ docker run -d
<p><strong>Install Matterbridge</strong></p>
<p>For installing matterbridge we should have a configuration file that says to the binary where to connect and what to do with the messages, so first of all we will create our <code>matterbridge.toml</code> file:</p>
```
```bash
[irc]
[irc.freenode]
Server="irc.freenode.net:6667"
@ -88,7 +88,7 @@ enable=true
</ul>
<p>So, it's time to run the bridge:</p>
```
```bash
docker run -d
-v /home/docker/matterbridge/matterbridge.toml:/matterbridge.toml
-h matterbridge01

View File

@ -11,23 +11,23 @@ image: IMG_20181109_090634_Bokeh.jpg
<p>&iquest;Por qu&eacute;?, porque hace alg&uacute;n tiempo, en las instalaciones por defecto, la partici&oacute;n con mayor tama&ntilde;o era esa, as&iacute; que lo ped&iacute;a a gritos. Y hasta el momento no he cambiado porque todos los scripts de deploy, provisionamiento y dem&aacute;s est&aacute;n prepardos para ello. Vagancia.</p>
<p>Estos &uacute;ltimos d&iacute;as he tenido un problema que nunca me hab&iacute;a pasado antes con un servidor. En este caso, inicialmente no hab&iacute;a separaci&oacute;n de particiones y todo estaba montado en <code>/</code>, pero ante la falta de espacio se contrat&oacute; un disco a mayores con la idea de montarlo en <code>/home</code> de forma separada y mover el grueso de la informaci&oacute;n ah&iacute; dentro:</p>
```
# mkfs.ext4 /dev/sdb1
# mkdir /home2
# mount /dev/sdb1 /home2
# rsync -az /home/ /home2/
# umount /home2
# mount /dev/sdb1 /home
```sh
$ mkfs.ext4 /dev/sdb1
$ mkdir /home2
$ mount /dev/sdb1 /home2
$ rsync -az /home/ /home2/
$ umount /home2
$ mount /dev/sdb1 /home
```
<p>Creamos la partici&oacute;n del nuevo dispositivo, la montamos como <code>/home2</code>, sincronizamos datos, desmontamos <code>/home2</code> y la montamos de nuevo como <code>/home</code>. Hasta aqu&iacute; todo correcto &iquest;no?. Pues no. Si el antiguo <code>/home</code> no se borra queda ah&iacute; consumiendo espacio y - lo m&aacute;s gracioso - como posteriormente montamos <code>/dev/sdb1</code> como <code>/home</code>, queda oculto.</p>
<p>As&iacute; que, cuando vayas a mirar por qu&eacute; sigue qued&aacute;ndose <code>/</code> sin espacio habiendo descargado todo "<em>lo gordo</em>" te podr&aacute; pasar como a m&iacute; y perder 3 horas de research con <code>du</code>, <code>df</code>, scripts en <code>bash</code>, <code>lsof</code> y dem&aacute;s. O quiz&aacute;s seas un poco m&aacute;s avispado y te des cuenta. Soluci&oacute;n:</p>
```
# mv /home /home_old
# mount /dev/sdb1 /home
# echo "Comprueba que todo funciona, varias veces, y posteriormente:"
# rm -rf /home_old
```sh
$ mv /home /home_old
$ mount /dev/sdb1 /home
$ echo "Comprueba que todo funciona, varias veces, y posteriormente:"
$ rm -rf /home_old
```
<p>Moraleja: nunca juegues al escondite con tus sistemas. Y menos si eres t&uacute; el que pone unas normas que luego no recuerdas.</p>

View File

@ -12,7 +12,7 @@ image: tmux-vim-vimux.png
<p style="text-align: center;"><img style="width: 100%; height: 100%;" src="gallery/tmux-vim-vimux.gif" alt="tmux, vim, vimux" /></p>
<p>You can <a href="gallery/vimux">Vimux</a> and it just opens a tmux pane (or window), execute the command you want, and go back to vim. The configuration I wrote (<code>~/.vimrc</code>):</p>
```
```vim
"---------------------------------------------------------
"------------- Vimux
"---------------------------------------------------------