Pulizia e aggiunta Documenti per migrazione server
This commit is contained in:
parent
ca73cafc45
commit
11ba04664f
|
@ -1,54 +0,0 @@
|
||||||
---
|
|
||||||
tags: bitcoin, introduction, spanish
|
|
||||||
---
|
|
||||||
|
|
||||||
# Bitcoin
|
|
||||||
|
|
||||||
## Como funcionan los fees
|
|
||||||
|
|
||||||
Cada ~10m (varia mucho, muchas veces hasta se tarda mas de 30m) se genera un bloque que como máximo puede pesar hasta 1Mb de informacion.
|
|
||||||
|
|
||||||
La transaccion mas común y simple es de 2 entradas y 2 salidas, y esa pesa mas de 100 bytes, eso quiere decir que en un bloque caben menos de 10.000 transacciones.
|
|
||||||
|
|
||||||
Lo mineros son los encargados de decidir cuales transacciones entran o no en un bloque, y por lo general, ellos le dan prioridad a las que tengan mejor fee (la que tenga la mayor densidad de BTC, osea la mayor **BTC/vbyte**)
|
|
||||||
|
|
||||||
En esta pagina <https://bitcoinfees.earn.com> puedes ver estimaciones de los fees actuales. Ahorita están absurdamente bajos, osea una transaccion normal te puede estar costando menos de 300 satoshis(0.02# Bitcoin5$) menos de 2,5 centavos de dolar. Con una wallet en la que tu tengas el control, tú decides cuantos fees vas a pagar. Si no pagas comision, corres el riesgo de que ni uno de los mineros meta tu transaccion en la blockchain y nunca se confirme. En la práctica los fees dependen principalmente de 2 cosas:
|
|
||||||
|
|
||||||
- Congestión de la red, cuantas transacciones tienes haciendote competencia en el valor del fee (BTC/vbyte)
|
|
||||||
- Cuanto estás dispuesto a esperar
|
|
||||||
|
|
||||||
Fijate en la página, cada fila es un rango de fee/byte medido en **satoshis/byte**, el tamaño de la barra indica cuantas transacciones hay/habido en ese rango, y a la derecha, al final, hay una estimacion de minutos de espera (En la práctica varía)
|
|
||||||
|
|
||||||
El peso de una transaccion no solo depende de la cantidad de entradas y salidas, tambien depende del tipo de direcciones de las salidas (y quizas tambien de las entradas, not sure). Y existen 3 tipos de direcciones:
|
|
||||||
|
|
||||||
- 1... (clásica)
|
|
||||||
- 3... (Segwit envuelto en un script, para hacerlo compatible con la clásica)
|
|
||||||
- bc1... (Segwit nativo)
|
|
||||||
|
|
||||||
El primero es el mas ineficiente (el que pesa mas en una transaccion), y el último es el mas eficiente.
|
|
||||||
Ya todos los servicios se han adaptado al mas eficiente, asi que asegurate de que la wallet que uses tenga direcciones que empiecen por **bc1...**
|
|
||||||
|
|
||||||
## Wallets centralizadas vs descentralizadas
|
|
||||||
|
|
||||||
Las wallet descentralizadas modernas al momento de creacion generan un número aleatorio, que es básicamente el alma de tu wallet, de hecho, ese número **es** tu wallet, y quien lo tenga puede gastar tus BTC. Ese número te lo muestran en el formato **seed/semilla**, que es una lista de 12-24 palabras, es simplemente una forma mas presentable de mostrar el numero, ya que es mas facil de memorizar, y de transcribir.
|
|
||||||
Y muchas wallet van un paso mas allá e implementan el estandar **BIP39**, para encriptar esa **seed** con un **password** que tú escojas, y en estos casos para recuperar tu wallet vas a necesitar tanto la seed, como el password. Esta opcion es la que uso yo, porque entonces yo guardo tranquilamente mi **seed** en todos lados, sin preocuparme si alguien la llega a obtener, y solo me preocupo de guardar bien la clave, que es mas corta y aún mas fácil de memorizar y de guardar. (Es importante escoger una buena clave, mas q todo q sea larga, o te le pueden hacer bruteforce)
|
|
||||||
|
|
||||||
La necesidad de guardar bien esa clave es la desventaja que tienen las wallet descentralizadas vs las centralizadas/custodeadas, es muy facil cagarla, desde dejar muy a la vista la clave secreta a guardarla tan bien que se te pierde. O tambien si tienes muchos ahorros, tambien tienes que pensar en tener backups que tu familia pueda recuperar si te llega a pasar algo.
|
|
||||||
|
|
||||||
## lightning
|
|
||||||
|
|
||||||
Está construido encima de Bitcoin. Y está basado en una especie de contrato entre 2 partes, y cada parte puede decidir meter X cantidad de BTC para usarlos dentro de ese canal, y mientras ese canal está abierto ambas partes pueden tranzar sin comision alguna, porque no son transacciones que se guardan en la blockchain, son transacciones totalmente privadas.
|
|
||||||
Y aquí es donde entra lightning como tal, porque bajo ciertas condiciones, se pueden conectar los canales entre sí para así poder transferirle a entidades con las que no tengas canales abierto directamente.
|
|
||||||
|
|
||||||
Ventajas:
|
|
||||||
|
|
||||||
- Transacciones son casi instantáneas.
|
|
||||||
- Fees son aún mas bajos. Gratis si con quien abriste el canal de lightning es el mismo a quien le vas a pagar.
|
|
||||||
|
|
||||||
Desventajas:
|
|
||||||
|
|
||||||
- No es suficiente con guardar la **seed** y **password**, tu aplicacion tambien necesita guardar cada cambio que se haga en tus canales abiertos. (La única aplicacion que probé creo que tenia para configurar Google Drive para guardar todos esos cambios).
|
|
||||||
- Tu aplicacion tiene que estar pendiente de la red cada cierto tiempo (dependiendo de cuando tiempo se le configuró al canal, por lo general varios días)
|
|
||||||
- Capacidad limitada de cantidad de Bitcoins que puedes enviar, depende de la capacidad de los canales de la ruta que atraviesa la transacción.
|
|
||||||
|
|
||||||
Lightning sigue en desarrollo activo, y algunas de las desventajas son mejorables sacrificando decentralizacion, como hace Phoenix Wallet, que me parece un muy buen tradeoff para noobs.
|
|
|
@ -1,20 +0,0 @@
|
||||||
---
|
|
||||||
tags: tutorial, network, mikrotik, ssh, security, english
|
|
||||||
---
|
|
||||||
|
|
||||||
# Configure ssh keys in Mikrotik
|
|
||||||
|
|
||||||
```mikrotik
|
|
||||||
# Create a dummy file
|
|
||||||
/file print file=dummyFile
|
|
||||||
# Set its content to the public key
|
|
||||||
/file set dummyFile.txt contents="ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA7QEcjRkbBWpwE7zIShobue9aEGyVObVHDLhK"
|
|
||||||
# Assign public key to user
|
|
||||||
/user ssh-keys import public-key-file=dummyFile.txt user=admin
|
|
||||||
```
|
|
||||||
|
|
||||||
Change the *public key*, and *user* accordingly
|
|
||||||
|
|
||||||
## What led to learning this
|
|
||||||
|
|
||||||
After having troubles with a mikrotik router I had to reconfigure it from scratch (didn't have a backup :sad:), and in the process the router got hacked, which pushed me to improve security measures
|
|
|
@ -1,88 +0,0 @@
|
||||||
---
|
|
||||||
tags: database, potsgresql, sql, spanish
|
|
||||||
---
|
|
||||||
|
|
||||||
# Comandos principales
|
|
||||||
|
|
||||||
- `START TRANSACTION` se utiliza para abrir una transacción (desactiva temporalmente el modo `autocommit`).
|
|
||||||
- `COMMIT` se utiliza para que los cambios que están pendientes de la transacción actual, se vuelvan permanentes en la BD y cierra la transacción.
|
|
||||||
- `ROLLBACK` para deshechar cualquier cambio pendiente que se haya hecho en la transacción actual y cierra la transacción.
|
|
||||||
|
|
||||||
MYSQL por defecto funciona con el modo `autocommit` activado, eso quiere decir que cualquier consulta es una transacción implicitamente, osea, si hacen un `UPDATE ...` en el fondo InnoDB ejecuta algo parecido a esto:
|
|
||||||
|
|
||||||
```sql
|
|
||||||
START TRANSACTION;
|
|
||||||
UPDATE ...
|
|
||||||
COMMIT;
|
|
||||||
```
|
|
||||||
|
|
||||||
Si ese `UPDATE ...` falla estando el modo `autocommit` activado, entonces automáticamente se ejecuta un `ROLLBACK`
|
|
||||||
|
|
||||||
# Usos
|
|
||||||
|
|
||||||
## Ejecutar todo o nada
|
|
||||||
|
|
||||||
Supongamos que queremos ejecutar una serie de consultas que modifican la BD, pero queremos que se ejecuten todas, y que si cualquiera falla que se deshagan los cambios.
|
|
||||||
|
|
||||||
Podemos hacer algo así:
|
|
||||||
|
|
||||||
```sql
|
|
||||||
BEGIN
|
|
||||||
|
|
||||||
START TRANSACTION;
|
|
||||||
.. Consulta 1 ..
|
|
||||||
.. Consulta 2 .. # Esta consulta siempre falla
|
|
||||||
.. Consulta 3 ..
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
END
|
|
||||||
```
|
|
||||||
|
|
||||||
Al ejecutar ese procedimiento almacenado, se abre una transacción, se ejecuta la **Consulta 1**, y al intentar la **Consulta 2** falla.
|
|
||||||
|
|
||||||
Hay un problema aquí, la transacción no se deshace, sino que queda abierta, osea, tiene cambios hechos de la **Consulta 1**, pero no se han hecho permanentes en la BD (`COMMIT`), ni tampoco se han devuelto los cambios (`ROLLBACK`). Y puede ocurrir cualquiera de los dos escenarios. Por ejemplo si se cierra la conexión, la BD ejecuta un `ROLLBACK` y si se ejecuta cualquiera de estas consultas <https://dev.mysql.com/doc/refman/8.0/en/implicit-commit.html> se genera un `COMMIT` implicitamente.
|
|
||||||
|
|
||||||
Si en este estado de la BD se hace un `SELECT` para verificar si en la BD se hicieron los cambios de la **Consulta 1**, se va a obtener distintas respuestas dependiendo de si el `SELECT` se ejecuta desde la misma conexión/sesión o no.
|
|
||||||
|
|
||||||
Cuando se abre una transacción y se hace un cambio, ese cambio solamente es visible para esa misma sesión que abrió la transacción.
|
|
||||||
|
|
||||||
### Solución
|
|
||||||
|
|
||||||
Explicitamente hacer `ROLLBACK` cuando ocurra un error.
|
|
||||||
|
|
||||||
Para eso definimos un *HANDLER* para los errores, es como el equivalente a un `try ... catch` pero afecta a todo el procedimeinto almacenado
|
|
||||||
|
|
||||||
```sql
|
|
||||||
BEGIN
|
|
||||||
DECLARE EXIT HANDLER FOR SQLEXCEPTION
|
|
||||||
BEGIN
|
|
||||||
ROLLBACK;
|
|
||||||
RESIGNAL;
|
|
||||||
END;
|
|
||||||
|
|
||||||
START TRANSACTION;
|
|
||||||
.. Consulta 1 ..
|
|
||||||
.. Consulta 2 .. # Esta consulta siempre falla
|
|
||||||
.. Consulta 3 ..
|
|
||||||
COMMIT;
|
|
||||||
|
|
||||||
END
|
|
||||||
```
|
|
||||||
|
|
||||||
Ahora cuando la **Consulta 2** falle, se dispara el handler, y se ejecutan los comandos `ROLLBACK` y `RESIGNAL`. *RESIGNAL* sirve para que se vuelva a lanzar el error, ya que de lo contrario el procedimiento almacenado termina *"exitosamente"* a pesar de que hubo un error.
|
|
||||||
|
|
||||||
## Bloquear tablas
|
|
||||||
|
|
||||||
Luego de abrir una transaccion con `START TRANSACTION` las consultas como el `INSERT`, `UPDATE` o `DELETE` bloquean las tablas, registros o índices que afecten, hasta que dicha transacción se cierre ya sea con un `COMMIT` o un `ROLLBACK`.
|
|
||||||
|
|
||||||
Esto sirve para que cualquier otra consulta que quiera leer o modificar los elementos bloqueados, deban esperar hasta que la transacción que los bloquea se cierre y los libere.
|
|
||||||
|
|
||||||
Los `SELECT` normales no generan ningun bloqueo, para eso existen el `SELECT ... FOR SHARE` y el `SELECT ... FOR UPDATE`.
|
|
||||||
|
|
||||||
En términos simples el **FOR SHARE** bloquea los elementos seleccionados para que otra consulta no pueda escribir sobre ellos hasta que se cierre la transacción, y el **FOR UPDATE** adicionalmente impide que tampoco puedan leerlos (igual que los `INSERT`, `UPDATE` o `DELETE`). Mas información <https://dev.mysql.com/doc/refman/8.0/en/innodb-locking-reads.html>
|
|
||||||
|
|
||||||
### Recomendaciones
|
|
||||||
|
|
||||||
Hay que analizar detalladamente todo lo que se mete dentro de una transacción, y reducirlo a lo mas mínimo posible, para evitar [Deadlocks](https://dev.mysql.com/doc/refman/5.7/en/innodb-deadlocks.html) o retrasos debido a bloqueos innecesarios.
|
|
||||||
|
|
||||||
Usar índices en todos los `WHERE` de las consultas que bloquean, para que dichos bloqueos sean lo mas óptimos posibles, y se bloquee solo lo que hace falta bloquear.
|
|
|
@ -1,43 +0,0 @@
|
||||||
---
|
|
||||||
tags: me, values, draft, english
|
|
||||||
---
|
|
||||||
|
|
||||||
*WARNING: this is work-in-progress, and has many disconnected trains of thought*
|
|
||||||
|
|
||||||
# Core values
|
|
||||||
|
|
||||||
Theoretically, these values do not depend on any truth about the world we live in
|
|
||||||
|
|
||||||
- Preserve **my identity** as much as possible
|
|
||||||
|
|
||||||
**My Identity** are all the things that I like about me that makes me who I am (My idealized self), and it breaks the boundaries of my own physical body. My family is also part of who I am but in a lesser extent. The same goes for friends, strangers, living beings, and non-living things too. But also the things that made us.
|
|
||||||
|
|
||||||
I think as things get emotionally farther, the less I consider them to be **me**.
|
|
||||||
|
|
||||||
This is probably a reaction to the fear of dying.
|
|
||||||
|
|
||||||
- Reduce suffering
|
|
||||||
|
|
||||||
# Sub-Values
|
|
||||||
|
|
||||||
Values that are a consequence of my [Core Values](#core-values) and the way the physical world works
|
|
||||||
|
|
||||||
- Maximize people's values, as long as they don't conflict with a common shared values
|
|
||||||
|
|
||||||
As a society have we ever defined these **shared values** in a cristal clear way?.\
|
|
||||||
I'm not sure what the differences are among countries.\
|
|
||||||
Shouldn't congresses around the world vote about this?, Do they do it and I'm just ignorant?\
|
|
||||||
I don't even know the values of the societies I am part of, I should know this!
|
|
||||||
|
|
||||||
- Improve, improve, improve! (But improve what?)
|
|
||||||
- Equal oportunities among humans (redundant?)
|
|
||||||
- Knowledge
|
|
||||||
- Intelligence
|
|
||||||
|
|
||||||
# Biases
|
|
||||||
|
|
||||||
Like [Sub-Values](#sub-values) but applies when in doubt (high uncertainty) about the physical world, so these values may be wrong and might change in the future if more knowledge is gathered or dynamics of the physical world change. But I have a strong enough opinion to put them here
|
|
||||||
|
|
||||||
- Democracy
|
|
||||||
- I value honesty, but mostly I hate perverse social dynamics that requires me to lie in order to succeed (I hate this so hard!) and I love to incentivize situations where honesty emerges as a social dynamic consequence. So I'm sympathetic to other people that lie under the burden of perversive social dynamics
|
|
||||||
-
|
|
|
@ -1,37 +0,0 @@
|
||||||
---
|
|
||||||
tags: probability, expected value, math, blog, investment, gambling, draft, english
|
|
||||||
---
|
|
||||||
|
|
||||||
*WARNING: this is work-in-progress, and has many disconnected trains of thought*
|
|
||||||
|
|
||||||
# How to gamble rationally
|
|
||||||
|
|
||||||
Gambling is essentially an investment, and almost surely a bad one in lotteries and casinos, and a negative-sum-game in the betting industry.
|
|
||||||
|
|
||||||
But gambling can be a good investment and a positive-sum-game if we use it to bring investment opportunities, that are too expensive for our budget, into our possibilities with an X% chance of happening, and thus increase the **expected value** of the same budget.
|
|
||||||
|
|
||||||
## Pre-required readings
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>What is <strong>expected value</strong>?</summary>
|
|
||||||
|
|
||||||
asdadasd
|
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>How <strong>expected value</strong> power <strong>investments</strong>?</summary>
|
|
||||||
|
|
||||||
- When expected value is below target, increasing variance increases the chance of reaching the target
|
|
||||||
- Subjective value of money does not correlate linearly with its quantity
|
|
||||||
- A gambling's expected value is less than the betting quantity, i.e. on itself is a bad investment. But things can change if you mix it with the expected value of a profitable investment that is normally beyond your budget, hence out of your reach. In other words, betting increases variance, and since budget is below the investment required, it increases chance of making that investment
|
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
## Expected value
|
|
||||||
|
|
||||||
https://bestbet.data36.com
|
|
||||||
|
|
||||||
## Other articles
|
|
||||||
|
|
||||||
https://news.ycombinator.com/item?id=26283650
|
|
||||||
https://en.wikipedia.org/wiki/Kelly_criterion
|
|
24
DynamoDB.md
24
DynamoDB.md
|
@ -1,24 +0,0 @@
|
||||||
---
|
|
||||||
tags: knowledge, database, nosql, english
|
|
||||||
---
|
|
||||||
|
|
||||||
# DynamoDB
|
|
||||||
|
|
||||||
It's a [[NoSQL]] [[Database]] from [[AWS]]
|
|
||||||
|
|
||||||
## Differences from SQL Database
|
|
||||||
|
|
||||||
- Records of a table can have different fields
|
|
||||||
- Tables can be partitioned using **partition keys**, I think you cannot query *fast* across different partitions. I think an analogy to **partition keys** would be like having a table across multiple databases in [[SQL]] Databases
|
|
||||||
- Tables also have **sort keys**, this determines how records are ordered, and you can only query contiguous records, I think you cannot filter nor change the order (maybe only reverse the default order)
|
|
||||||
- So basically **partition keys** and **sort keys** determines how the table can be queried. This limitations is the tradeoff that makes [[DynamoDB]] fast.
|
|
||||||
- There are some advantages with the connection management, I think it allows a lot more concurrent connections, but I don't know the details.
|
|
||||||
|
|
||||||
## Use cases
|
|
||||||
|
|
||||||
- High scalability
|
|
||||||
- Better integration with serverless architecture, because of better connection management
|
|
||||||
|
|
||||||
## What led to learning this
|
|
||||||
|
|
||||||
Podcast: [Full Stack Radio: 139: Alex DeBrie - DynamoDB for Relational Database Diehards](https://fullstackradio.com/episodes/139-20f6bb42)
|
|
|
@ -1,25 +0,0 @@
|
||||||
---
|
|
||||||
tags: database, potsgresql, sql, english
|
|
||||||
---
|
|
||||||
|
|
||||||
# INSERT ... RETURNING
|
|
||||||
|
|
||||||
You can return any information about any inserted element in the `INSERT` statement by using the `RETURNING ...` clause
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
```sql
|
|
||||||
INSERT INTO roles (name)
|
|
||||||
VALUES ('master')
|
|
||||||
RETURNING role_id
|
|
||||||
```
|
|
||||||
|
|
||||||
So after `RETURNING` you choose all the columns you want to get
|
|
||||||
|
|
||||||
Very useful along [[The WITH statement]] to chain a bunch of insertions atomically without using transactions
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## What led to learning this
|
|
||||||
|
|
||||||
- Started using the SQL language in PostgreSQL. Working on a [tiny family project](https://github.com/taionca/taionca/)
|
|
|
@ -1,21 +0,0 @@
|
||||||
---
|
|
||||||
tags: knowledge, frontend, lazy-load, english
|
|
||||||
---
|
|
||||||
|
|
||||||
# Lazy loading images in HTML
|
|
||||||
|
|
||||||
To implement [[Lazy Loading]] to an `<img ... >` tag, add the attribute `loading=lazy`
|
|
||||||
|
|
||||||
```html
|
|
||||||
<img loading=lazy ... >
|
|
||||||
```
|
|
||||||
|
|
||||||
This will load the image when scrolling is near the viewport, using the [Intersection Observer API](https://developers.google.com/web/updates/2016/04/intersectionobserver)
|
|
||||||
|
|
||||||
## Further reading
|
|
||||||
|
|
||||||
- [Native image lazy-loading](https://web.dev/native-lazy-loading)
|
|
||||||
|
|
||||||
## What led to learning this
|
|
||||||
|
|
||||||
Accidentally: a rabbit hole that started at [Jason Crawford's github](https://github.com/jasoncrawford) and ended at an [issue in the owid-grapher repo](https://github.com/owid/owid-grapher/pull/422)
|
|
|
@ -1,33 +0,0 @@
|
||||||
---
|
|
||||||
tags: knowledge, web, protocol, english
|
|
||||||
---
|
|
||||||
|
|
||||||
# Open Graph Protocol
|
|
||||||
|
|
||||||
This is a standard that uses websites to tell external websites how a link preview should look
|
|
||||||
|
|
||||||
Works by defining `<meta/>` tags like `<meta property="og:{}" content="{}" />`
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
```html
|
|
||||||
<html prefix="og: https://ogp.me/ns#">
|
|
||||||
<head>
|
|
||||||
<title>The Rock (1996)</title>
|
|
||||||
<meta property="og:title" content="The Rock" />
|
|
||||||
<meta property="og:type" content="video.movie" />
|
|
||||||
<meta property="og:url" content="https://www.imdb.com/title/tt0117500/" />
|
|
||||||
<meta property="og:image" content="https://ia.media-imdb.com/images/rock.jpg" />
|
|
||||||
...
|
|
||||||
</head>
|
|
||||||
...
|
|
||||||
</html>
|
|
||||||
```
|
|
||||||
|
|
||||||
## Further reading
|
|
||||||
|
|
||||||
- [Official documentation](https://ogp.me/)
|
|
||||||
|
|
||||||
## What led to learning this
|
|
||||||
|
|
||||||
I Linked to [Bolivar Paralelo](https://bolivarparalelo.com/) in my [LinkedIn](https://www.linkedin.com/in/madacol/) and the preview was garbage
|
|
|
@ -1,15 +0,0 @@
|
||||||
---
|
|
||||||
tags: knowledge, frontend, english
|
|
||||||
---
|
|
||||||
|
|
||||||
# Perfectly centering pixels is tricky
|
|
||||||
|
|
||||||
To perfectly center a container (like a `<div>`) inside another container, both containers' sizes must have the same parity, in other words, both sizes must be either even or odd, in the direction of centering.
|
|
||||||
|
|
||||||
Same thing happens if many containers are nested, and each of them need to be centered across its parent, they all need to be even or odd.
|
|
||||||
|
|
||||||
Font makes things trickier. Let's suppose you want to center vertically a text inside an even container, and you may think that choosing an even `font-size` will do the trick, but if you choose a size like `14px` and a `line height` different than `1` or `2` (both options are unpleasant in most cases), then text's effective height will be odd, and text `height` parity will mismatch with its parent and will be impossible to center.
|
|
||||||
|
|
||||||
## What led to learning this
|
|
||||||
|
|
||||||
Podcast: [Full Stack Radio: 135: Lessons Learned Building Tailwind UI](https://fullstackradio.com/episodes/135-e8c69ea6)
|
|
29
README.md
29
README.md
|
@ -1,29 +0,0 @@
|
||||||
# Knowledge
|
|
||||||
|
|
||||||
I'm still experimenting with this, but I will eventually make a blog based on these articles.
|
|
||||||
|
|
||||||
# Usage
|
|
||||||
|
|
||||||
You can read this in github in the meantime, but wiki-links will only render properly while editing in Vscode with this extension [Markdown Memo](https://marketplace.visualstudio.com/items?itemName=svsool.markdown-memo) `ext install svsool.markdown-memo`
|
|
||||||
|
|
||||||
## Vscode extensions for editing
|
|
||||||
|
|
||||||
***Note:** VSCode should recommend you to install them all when you open this project*
|
|
||||||
|
|
||||||
- [Markdown Memo](https://marketplace.visualstudio.com/items?itemName=svsool.markdown-memo) `ext install svsool.markdown-memo`
|
|
||||||
- [Markdown All in One](https://marketplace.visualstudio.com/items?itemName=yzhang.markdown-all-in-one) `ext install yzhang.markdown-all-in-one`
|
|
||||||
- [Markdown Paste](https://marketplace.visualstudio.com/items?itemName=telesoho.vscode-markdown-paste-image) `ext install telesoho.vscode-markdown-paste-image`
|
|
||||||
- [markdownlint](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint) `ext install davidanson.vscode-markdownlint`
|
|
||||||
- [Auto Snippet](https://marketplace.visualstudio.com/items?itemName=Gruntfuggly.auto-snippet) `ext install gruntfuggly.auto-snippet`
|
|
||||||
|
|
||||||
### Install all command
|
|
||||||
|
|
||||||
code --install-extension svsool.markdown-memo &
|
|
||||||
code --install-extension yzhang.markdown-all-in-one &
|
|
||||||
code --install-extension telesoho.vscode-markdown-paste-image &
|
|
||||||
code --install-extension davidanson.vscode-markdownlint &
|
|
||||||
code --install-extension gruntfuggly.auto-snippet &
|
|
||||||
|
|
||||||
### Optional
|
|
||||||
|
|
||||||
- [Markdown Links](https://marketplace.visualstudio.com/items?itemName=tchayen.markdown-links) `ext install tchayen.markdown-links` - provides a command to show the graph of links
|
|
|
@ -1,37 +0,0 @@
|
||||||
---
|
|
||||||
tags: tutorial, ipfs, file-sharing, nat, english
|
|
||||||
---
|
|
||||||
|
|
||||||
# Share file with ipfs
|
|
||||||
|
|
||||||
**Warning:** Only tested serving the file, not downloading it
|
|
||||||
|
|
||||||
1. [Install ipfs](https://ipfs.io/#install)
|
|
||||||
2. Initiate ipfs main folder `ipfs init`, not sure why but this is required for following commands
|
|
||||||
3. Serve a file `ipfs add {filepath}`. It should return something like this
|
|
||||||
|
|
||||||
```bash
|
|
||||||
added QmdsEVLRXioANssEVLRXYioANsGtANsGtRXYioANsGtAWZ file.md
|
|
||||||
37.62 KiB / 37.62 KiB [===========================] 100.00%
|
|
||||||
```
|
|
||||||
|
|
||||||
4. Start server with `ipfs daemon`
|
|
||||||
5. **Missing step**, server seems to need an open port (not firewalled)
|
|
||||||
6. Download file from any device `ipfs get /ipfs/QmdsEVLRXioANssEVLRXYioANsGtANsGtRXYioANsGtAWZ` <-- that's the hash returned from **step 3**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ ls
|
|
||||||
QmdsEVLRXioANssEVLRXYioANsGtANsGtRXYioANsGtAWZ
|
|
||||||
```
|
|
||||||
|
|
||||||
Notice the filename is just the hash, the original filename is lost.
|
|
||||||
|
|
||||||
**Note:** *IPNS seems to solve the filename problem, need to research on how to use it*
|
|
||||||
|
|
||||||
## Troubleshoot
|
|
||||||
<https://github.com/ipfs/go-ipfs/blob/master/docs/file-transfer.md>
|
|
||||||
|
|
||||||
## What led to learning this
|
|
||||||
|
|
||||||
[Random news of ipfs in HN](https://blog.ipfs.io/2020-09-24-go-ipfs-0-7-0/). It just reminded me I've never tried it out.\
|
|
||||||
And in recent months I've had difficulty sharing files p2p
|
|
|
@ -1,69 +0,0 @@
|
||||||
---
|
|
||||||
tags: tutorial, tor, ssh, nat, firewall, spanish
|
|
||||||
---
|
|
||||||
|
|
||||||
# Configurar a un servicio onion
|
|
||||||
|
|
||||||
*copiado sin verguenza alguna de <https://www.techrepublic.com/article/how-to-run-an-ssh-connection-through-tor/>*
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Instalar Tor
|
|
||||||
|
|
||||||
Instalar Tor en el cliente y en el servidor:
|
|
||||||
|
|
||||||
sudo apt-get install tor -y
|
|
||||||
|
|
||||||
## Configurar Tor
|
|
||||||
|
|
||||||
1. En el servidor vamos a editar el archivo de configuración de tor `/etc/tor/torrc`:
|
|
||||||
|
|
||||||
sudo nano /etc/tor/torrc
|
|
||||||
|
|
||||||
2. Al final del archivo vamos a agregar esto:
|
|
||||||
|
|
||||||
HiddenServiceDir /var/lib/tor/ssh/
|
|
||||||
HiddenServicePort 22
|
|
||||||
|
|
||||||
<kbd>Ctrl</kbd>+<kbd>x</kbd> para guardar y cerrar el archivo.
|
|
||||||
|
|
||||||
3. Reiniciar Tor:
|
|
||||||
|
|
||||||
sudo systemctl restart tor
|
|
||||||
|
|
||||||
## Obtener la direccion .onion
|
|
||||||
|
|
||||||
Estará en el archivo `hostname` en la carpeta configurada anteriormente `/var/lib/tor/ssh/`
|
|
||||||
|
|
||||||
sudo cat /var/lib/tor/ssh/hostname
|
|
||||||
|
|
||||||
Deberia arrojarte algo así: `riludi2kstjwmlzn.onion`
|
|
||||||
|
|
||||||
## Conectarse al servidor ssh con la direccion .onion
|
|
||||||
|
|
||||||
torify ssh ... # reemplazar el dominio/ip por la direccion .onion`
|
|
||||||
|
|
||||||
Por ejemplo:
|
|
||||||
|
|
||||||
torify ssh jack@riludi2kstjwmlzn.onion
|
|
||||||
|
|
||||||
### Opcional
|
|
||||||
|
|
||||||
Para no tener que recordar la direccion **.onion** puedes configurar los parámetros de conexión en el archivo `~/.ssh/config`
|
|
||||||
|
|
||||||
nano ~/.ssh/config
|
|
||||||
|
|
||||||
Ingresar configuracion:
|
|
||||||
|
|
||||||
Host serverTor
|
|
||||||
User jack
|
|
||||||
HostName riludi2kstjwmlzn.onion
|
|
||||||
Port 22
|
|
||||||
|
|
||||||
Ahora puedes conectarte así:
|
|
||||||
|
|
||||||
torify ssh serverTor
|
|
||||||
|
|
||||||
## Mas informacion
|
|
||||||
|
|
||||||
<https://community.torproject.org/onion-services/setup/>
|
|
|
@ -1,69 +0,0 @@
|
||||||
---
|
|
||||||
tags: tutorial, tor, ssh, nat, firewall, english
|
|
||||||
---
|
|
||||||
|
|
||||||
# Configure an onion service
|
|
||||||
|
|
||||||
*Shamelessly copied from <https://www.techrepublic.com/article/how-to-run-an-ssh-connection-through-tor/>*
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Install Tor
|
|
||||||
|
|
||||||
Install Tor on both client and server:
|
|
||||||
|
|
||||||
sudo apt-get install tor -y
|
|
||||||
|
|
||||||
## Configure Tor
|
|
||||||
|
|
||||||
1. In the server let's edit tor's config file `/etc/tor/torrc`:
|
|
||||||
|
|
||||||
sudo nano /etc/tor/torrc
|
|
||||||
|
|
||||||
2. At the bottom of that file, add this:
|
|
||||||
|
|
||||||
HiddenServiceDir /var/lib/tor/ssh/
|
|
||||||
HiddenServicePort 22
|
|
||||||
|
|
||||||
<kbd>Ctrl</kbd>+<kbd>x</kbd> to save and close file.
|
|
||||||
|
|
||||||
3. Restart Tor:
|
|
||||||
|
|
||||||
sudo systemctl restart tor
|
|
||||||
|
|
||||||
## Get .onion address
|
|
||||||
|
|
||||||
It will be in the file `hostname` in the previously configured folder `/var/lib/tor/ssh`
|
|
||||||
|
|
||||||
sudo cat /var/lib/tor/ssh/hostname
|
|
||||||
|
|
||||||
You should get something like `riludi2kstjwmlzn.onion`
|
|
||||||
|
|
||||||
## Connect to the Tor hidden ssh server
|
|
||||||
|
|
||||||
torify ssh ... # replace the domain/ip with the .onion address
|
|
||||||
|
|
||||||
For example:
|
|
||||||
|
|
||||||
torify ssh jack@riludi2kstjwmlzn.onion
|
|
||||||
|
|
||||||
### Optional
|
|
||||||
|
|
||||||
You don't need to remember the **.onion** address, you can write an entry to your user's ssh config file `~/.ssh/config`:
|
|
||||||
|
|
||||||
nano ~/.ssh/config
|
|
||||||
|
|
||||||
Set configuration:
|
|
||||||
|
|
||||||
Host serverTor
|
|
||||||
User jack
|
|
||||||
HostName riludi2kstjwmlzn.onion
|
|
||||||
Port 22
|
|
||||||
|
|
||||||
Now you can simply connect with:
|
|
||||||
|
|
||||||
torify ssh serverTor
|
|
||||||
|
|
||||||
## More info
|
|
||||||
|
|
||||||
<https://community.torproject.org/onion-services/setup/>
|
|
|
@ -1,36 +0,0 @@
|
||||||
---
|
|
||||||
tags: database, potsgresql, transaction, sql, english
|
|
||||||
---
|
|
||||||
|
|
||||||
# The WITH statement
|
|
||||||
|
|
||||||
Allows to save into variables tables results returned from a `SELECT` or [[INSERT ... RETURNING]] statement, and use them in following querys.
|
|
||||||
|
|
||||||
Also allows to chain multiple `INSERTS`, and if any of them fails, all previous `INSERTS` are rolledback.\
|
|
||||||
*Note: autoincrements still increase on failures, hence skipped.*
|
|
||||||
|
|
||||||
So It's excellent to avoid explicitly using transactions
|
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||
```sql
|
|
||||||
WITH inserted_user as (
|
|
||||||
INSERT INTO users (username, name, password_hash)
|
|
||||||
VALUES ('master', 'master', '$argon2i$v=19$m=4096,t=10,p=1$l9mKHF/++OJO4Fzj5VvOxw$smezKrrynx74W2+7L4zyiKUXWFdQDqdKf2RBMU4p0JI')
|
|
||||||
RETURNING user_id
|
|
||||||
), inserted_role as (
|
|
||||||
INSERT INTO roles (name)
|
|
||||||
VALUES ('master')
|
|
||||||
RETURNING role_id
|
|
||||||
), t as (
|
|
||||||
INSERT INTO join_users_roles (user_id, role_id)
|
|
||||||
SELECT user_id, role_id
|
|
||||||
FROM inserted_user, inserted_role
|
|
||||||
)
|
|
||||||
INSERT INTO join_roles_permissions (role_id, permission_id)
|
|
||||||
SELECT role_id, permission_id FROM inserted_role, permissions;
|
|
||||||
```
|
|
||||||
|
|
||||||
## What led to learning this
|
|
||||||
|
|
||||||
- Needed to insert a bunch of data atomically accross many tables, see the [example](#example) above. Working on a [tiny family project](https://github.com/taionca/taionca/)
|
|
|
@ -1,117 +0,0 @@
|
||||||
---
|
|
||||||
tags: cheatsheet, terminal, bash, zsh, shortcuts, english
|
|
||||||
---
|
|
||||||
|
|
||||||
# Terminal Shortcuts
|
|
||||||
|
|
||||||
## Default shortcuts
|
|
||||||
|
|
||||||
For Ubuntu's default keybinding settings (i.e Emacs keybindings)
|
|
||||||
|
|
||||||
### Insert previous arguments
|
|
||||||
|
|
||||||
- <kbd>Alt</kbd>+<kbd>.</kbd>: insert last argument from last command.
|
|
||||||
- <kbd>Alt</kbd>+<kbd>number</kbd>+<kbd>.</kbd>: insert #nth last argument from last command.
|
|
||||||
- <kbd>Alt</kbd>+<kbd>-</kbd> , <kbd>number</kbd> , <kbd>Alt</kbd>+<kbd>.</kbd>, **zsh:** <kbd>Alt</kbd>+<kbd>-</kbd>+<kbd>number</kbd>+<kbd>.</kbd>: insert #nth first argument from last command.
|
|
||||||
|
|
||||||
In Linux you can repeat commands to go back in history
|
|
||||||
|
|
||||||
#### Example
|
|
||||||
|
|
||||||
Last command is:
|
|
||||||
|
|
||||||
mv foo bar
|
|
||||||
|
|
||||||
- <kbd>Alt</kbd>+<kbd>0</kbd>+<kbd>.</kbd>: insert first argument of last command = `mv`
|
|
||||||
- <kbd>Alt</kbd>+<kbd>2</kbd>+<kbd>.</kbd>: insert last 2nd argument of last command = `foo`
|
|
||||||
- <kbd>up</kbd> , <kbd>Ctrl</kbd>+<kbd>w</kbd>: last command without the last word = `mv foo`
|
|
||||||
|
|
||||||
### Cut/Paste commands
|
|
||||||
|
|
||||||
(relative to cursor's position)
|
|
||||||
|
|
||||||
- <kbd>Ctrl</kbd>+<kbd>w</kbd>: cuts last word
|
|
||||||
- <kbd>Alt</kbd>+<kbd>d</kbd>: cuts next word
|
|
||||||
- <kbd>Ctrl</kbd>+<kbd>k</kbd>: cuts everything after
|
|
||||||
- <kbd>Ctrl</kbd>+<kbd>u</kbd>, **zsh:** <kbd>Alt</kbd>+<kbd>w</kbd>: cuts everything before
|
|
||||||
- **zsh:** <kbd>Ctrl</kbd>+<kbd>u</kbd>: cuts the entire command *(In bash you can combine <kbd>Ctrl</kbd>+<kbd>u</kbd> , <kbd>Ctrl</kbd>+<kbd>k</kbd>)*
|
|
||||||
- <kbd>Ctrl</kbd>+<kbd>y</kbd>: paste characters previously cut with any **Cut command**. *In bash you can chain **cut commands**, and <kbd>Ctrl</kbd>+<kbd>y</kbd> will paste them all.*
|
|
||||||
|
|
||||||
### Move cursor
|
|
||||||
|
|
||||||
- <kbd>Ctrl</kbd>+<kbd>left</kbd>: move to last word
|
|
||||||
- <kbd>Ctrl</kbd>+<kbd>right</kbd>: move to next word
|
|
||||||
- <kbd>home</kbd> or <kbd>Ctrl</kbd>+<kbd>a</kbd>: move to start of command
|
|
||||||
- <kbd>end</kbd> or <kbd>Ctrl</kbd>+<kbd>e</kbd>: move to end of command
|
|
||||||
|
|
||||||
### Other
|
|
||||||
|
|
||||||
- <kbd>Ctrl</kbd>+<kbd>_</kbd>: undo last edit *(very useful when exceeding <kbd>Ctrl</kbd>+<kbd>w</kbd>)*
|
|
||||||
|
|
||||||
### To see all shortcuts available
|
|
||||||
|
|
||||||
- **bash:** `bind -lp`
|
|
||||||
- **zsh:** `bindkey -L`
|
|
||||||
|
|
||||||
## Custom shortcuts
|
|
||||||
|
|
||||||
### Iterate through arguments
|
|
||||||
|
|
||||||
only works in zsh, and probably only Linux
|
|
||||||
|
|
||||||
#### Description
|
|
||||||
|
|
||||||
Insert any argument of a previous command by iterating one by one until selection
|
|
||||||
|
|
||||||
#### Setup Instructions
|
|
||||||
|
|
||||||
run this:
|
|
||||||
|
|
||||||
autoload -Uz copy-earlier-word
|
|
||||||
zle -N copy-earlier-word
|
|
||||||
bindkey "^[:" copy-earlier-word
|
|
||||||
|
|
||||||
*(to make this permanent, add it to your `~/.zshrc` and restart shell)*
|
|
||||||
|
|
||||||
Now use <kbd>Alt</kbd>+<kbd>.</kbd> to go as back as you want, then use <kbd>Alt</kbd>+<kbd>:</kbd> to iterate through the arguments
|
|
||||||
|
|
||||||
#### Example
|
|
||||||
|
|
||||||
Last command is
|
|
||||||
|
|
||||||
echo 1 2 3 4 5
|
|
||||||
|
|
||||||
- <kbd>Alt</kbd>+<kbd>.</kbd>: `5`
|
|
||||||
- <kbd>Alt</kbd>+<kbd>.</kbd>+<kbd>:</kbd>: `4`
|
|
||||||
- <kbd>Alt</kbd>+<kbd>.</kbd>+<kbd>:</kbd>+<kbd>:</kbd>: `3`
|
|
||||||
- <kbd>Alt</kbd>+<kbd>.</kbd>+<kbd>:</kbd>+<kbd>:</kbd>+<kbd>:</kbd>: `2`
|
|
||||||
- <kbd>Alt</kbd>+<kbd>.</kbd>+<kbd>:</kbd>+<kbd>:</kbd>+<kbd>:</kbd>+<kbd>:</kbd>: `1`
|
|
||||||
- <kbd>Alt</kbd>+<kbd>.</kbd>+<kbd>:</kbd>+<kbd>:</kbd>+<kbd>:</kbd>+<kbd>:</kbd>+<kbd>:</kbd>: `echo`
|
|
||||||
|
|
||||||
source: <https://stackoverflow.com/a/34861762/3163120>
|
|
||||||
|
|
||||||
## Other examples
|
|
||||||
|
|
||||||
### Common usecases
|
|
||||||
|
|
||||||
Let's consider the last command to be:
|
|
||||||
|
|
||||||
mv foo bar
|
|
||||||
|
|
||||||
<kbd>up</kbd> , <kbd>Ctrl</kbd>+<kbd>w</kbd>: last command without the last word = `mv foo`
|
|
||||||
|
|
||||||
<kbd>Alt</kbd>+<kbd>0</kbd>+<kbd>.</kbd>: first argument of last command = `mv`
|
|
||||||
|
|
||||||
## Limitations
|
|
||||||
|
|
||||||
"words" only includes `a-zA-Z` characters, so any symbol character will stop word-shortcuts.
|
|
||||||
|
|
||||||
So if last argument was a url and you want to erase it with <kbd>Ctrl</kbd>+<kbd>w</kbd> it will be a pain.
|
|
||||||
|
|
||||||
E.g: `curl -I --header "Connection: Keep-Alive" https://stackoverflow.com/questions/38176514/re-run-previous-command-with-different-arguments`
|
|
||||||
|
|
||||||
To erase that **url** using <kbd>Ctrl</kbd>+<kbd>w</kbd>, you'd have to repeat it 12 times.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
It would be great to have similar shortcuts that only stops at the **space character**
|
|
|
@ -1,188 +0,0 @@
|
||||||
---
|
|
||||||
tags: tutorial, ubuntu, ubuntu 20, install, setup, english
|
|
||||||
---
|
|
||||||
|
|
||||||
# Ubuntu fresh setup guide
|
|
||||||
|
|
||||||
## Update & Upgrade
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo apt update && sudo apt upgrade -y
|
|
||||||
```
|
|
||||||
|
|
||||||
## Install Packages
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo apt-get install python3-pip zsh curl wget git dconf-editor
|
|
||||||
sudo apt-get install p7zip-full smplayer cmus speedtest-cli git-gui filezilla pavucontrol paprefs ufw servefile nmap fail2ban gimp most colordiff mosh ncdu qalculate-gtk jq tor fonts-noto nautilus-actions filemanager-actions thunderbird chrome-gnome-shell gnome-tweaks smartmontools &
|
|
||||||
|
|
||||||
pip3 install youtube-dl tldr
|
|
||||||
```
|
|
||||||
|
|
||||||
## External Repositories
|
|
||||||
|
|
||||||
### Antimicro
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo add-apt-repository ppa:mdeguzis/libregeek
|
|
||||||
```
|
|
||||||
|
|
||||||
As of today, a bionic package is still not available, but the artful works!. <https://github.com/AntiMicro/antimicro/issues>
|
|
||||||
|
|
||||||
`sudo nano /etc/apt/sources.list.d/mdeguzis-ubuntu-libregeek-bionic.list` Replace `bionic` with `artful`
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install antimicro
|
|
||||||
```
|
|
||||||
|
|
||||||
Put config file <https://gist.github.com/madacol/19f8c71ba98f484a4294ccfe90e88e6e> in `~/.config/antimicro`
|
|
||||||
|
|
||||||
### SinkSwitcher
|
|
||||||
|
|
||||||
<https://github.com/madacol/sinkSwitcher>
|
|
||||||
|
|
||||||
## Web installs
|
|
||||||
|
|
||||||
- docker: <https://download.docker.com>
|
|
||||||
- VSCode: <https://code.visualstudio.com/>
|
|
||||||
- chrome: <https://www.chrome.com/>
|
|
||||||
- syncthing: <https://apt.syncthing.net/>
|
|
||||||
- Zsh-syntax-highlighting: <https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/INSTALL.md>
|
|
||||||
|
|
||||||
## Shells
|
|
||||||
|
|
||||||
### Fish
|
|
||||||
|
|
||||||
#### Functions
|
|
||||||
|
|
||||||
- nvm
|
|
||||||
|
|
||||||
Install bass, then configure these functions
|
|
||||||
|
|
||||||
- **__nvm_load.fish**
|
|
||||||
|
|
||||||
```fish
|
|
||||||
function __nvm_load
|
|
||||||
functions -e __nvm_load node npm npx
|
|
||||||
bass source ~/.nvm/nvm.sh --no-use ';' nvm use 2> /dev/null '||' nvm use default
|
|
||||||
end
|
|
||||||
```
|
|
||||||
|
|
||||||
- **nvm.fish**
|
|
||||||
|
|
||||||
```fish
|
|
||||||
function nvm
|
|
||||||
functions -e __nvm_load node npm npx
|
|
||||||
bass source ~/.nvm/nvm.sh --no-use ';' source ~/.nvm/bash_completion ';' nvm $argv
|
|
||||||
end
|
|
||||||
```
|
|
||||||
|
|
||||||
- **npx.fish**
|
|
||||||
|
|
||||||
```fish
|
|
||||||
function npx
|
|
||||||
__nvm_load
|
|
||||||
npx $argv
|
|
||||||
end
|
|
||||||
```
|
|
||||||
|
|
||||||
- **npm.fish**
|
|
||||||
|
|
||||||
```fish
|
|
||||||
function npm
|
|
||||||
__nvm_load
|
|
||||||
npm $argv
|
|
||||||
end
|
|
||||||
```
|
|
||||||
|
|
||||||
- **node.fish**
|
|
||||||
|
|
||||||
```fish
|
|
||||||
function node
|
|
||||||
__nvm_load
|
|
||||||
node $argv
|
|
||||||
end
|
|
||||||
```
|
|
||||||
|
|
||||||
### Zsh - Edit ~/.zshrc
|
|
||||||
|
|
||||||
#### Add `~/.local/bin` to PATH
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export PATH=$HOME/.local/bin:$PATH
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Add shortcut "Alt+:" [to iterate through arguments](https://stackoverflow.com/questions/4009412/how-to-use-arguments-from-previous-command/55069846#55069846)
|
|
||||||
|
|
||||||
```bash
|
|
||||||
autoload -Uz copy-earlier-word
|
|
||||||
zle -N copy-earlier-word
|
|
||||||
bindkey "^[:" copy-earlier-word
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Aliases
|
|
||||||
|
|
||||||
```bash
|
|
||||||
alias lr="ls -hartl"
|
|
||||||
alias youtube-dl720='youtube-dl -f "bestvideo[height<=720]+bestaudio/best[height<=720]"'
|
|
||||||
alias python=python3
|
|
||||||
alias ipython=ipython3
|
|
||||||
function mkcd () { mkdir -p "$@" && cd "$@"; }
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Lazy-load nvm
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
|
||||||
[ -s "$NVM_DIR/nvm.sh" ] && . $NVM_DIR/nvm.sh --no-use;
|
|
||||||
[ -s "$NVM_DIR/bash_completion" ] && . $NVM_DIR/bash_completion;
|
|
||||||
function __nvm_load_node () {
|
|
||||||
unalias node npm npx;
|
|
||||||
nvm use 2> /dev/null || nvm use default;
|
|
||||||
command=$1;
|
|
||||||
shift 1;
|
|
||||||
$command $@;
|
|
||||||
}
|
|
||||||
alias node='__nvm_load_node node $@'
|
|
||||||
alias npm='__nvm_load_node npm $@'
|
|
||||||
alias npx='__nvm_load_node npx $@'
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Enable most
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export PAGER=most
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Enable zsh plugins
|
|
||||||
|
|
||||||
```bash
|
|
||||||
plugins=(git zsh-syntax-highlighting zsh-autosuggestions)
|
|
||||||
```
|
|
||||||
|
|
||||||
**Note:** Probably need to install them first
|
|
||||||
|
|
||||||
## Gnome extensions
|
|
||||||
|
|
||||||
- Caffeine <https://extensions.gnome.org/extension/517/caffeine/>
|
|
||||||
- NetSpeed <https://extensions.gnome.org/extension/104/netspeed/>
|
|
||||||
- EasyScreenCast <https://extensions.gnome.org/extension/690/easyscreencast/>
|
|
||||||
|
|
||||||
## Dconf
|
|
||||||
|
|
||||||
### Built-in dash-to-dock extension
|
|
||||||
|
|
||||||
- `org.gnome.shell.extensions.dash-to-dock.click-action` = **`cycle-windows`**
|
|
||||||
- `org.gnome.shell.extensions.dash-to-dock.scroll-action` = **`cycle-windows`**
|
|
||||||
- `org.gnome.shell.extensions.dash-to-dock.show-windows-preview` = **`false`**
|
|
||||||
|
|
||||||
## Custom shortcuts
|
|
||||||
|
|
||||||
- `systemctl suspend`
|
|
||||||
- Cmus <https://medium.com/@madacol/configure-cmus-music-player-on-the-terminal-in-ubuntu-3c513d2d2cd0>
|
|
||||||
- `qalculate`
|
|
||||||
|
|
||||||
## StartUp
|
|
||||||
|
|
||||||
- Cmus `gnome-terminal -- cmus`
|
|
|
@ -1,47 +0,0 @@
|
||||||
---
|
|
||||||
tags: tutorial, ubuntu, ubuntu 18, ubuntu 20, network, troubleshoot, english
|
|
||||||
---
|
|
||||||
|
|
||||||
# NetworkManager
|
|
||||||
|
|
||||||
- `nm-applet` to run old GUI and activate `Enable Networking`.
|
|
||||||
|
|
||||||
- `nm-connection-editor` to edit any weird configuration in the connections.
|
|
||||||
|
|
||||||
- You can also see what the **NetworkManager** is doing with these commands.
|
|
||||||
```bash
|
|
||||||
# Run one by one to see if anything is useful
|
|
||||||
nmcli device
|
|
||||||
nmcli
|
|
||||||
nmcli device show
|
|
||||||
```
|
|
||||||
|
|
||||||
`unmanaged` means **NetworkManager** will not manage that device.
|
|
||||||
|
|
||||||
### Documentation: https://help.ubuntu.com/community/NetworkManager
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
# Netplan
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Create a config file
|
|
||||||
sudo nano /etc/netplan/ethernet.yaml
|
|
||||||
```
|
|
||||||
and enter this
|
|
||||||
```bash
|
|
||||||
network:
|
|
||||||
version: 2
|
|
||||||
renderer: networkd
|
|
||||||
ethernets:
|
|
||||||
eno1:
|
|
||||||
dhcp4: true
|
|
||||||
```
|
|
||||||
replace `eno1` with whatever your device is (mine was `ens33`).
|
|
||||||
To see your list of devices, run `ip addr`.
|
|
||||||
|
|
||||||
Finally apply the new configurations
|
|
||||||
|
|
||||||
sudo netplan apply
|
|
||||||
|
|
||||||
### Documentation: https://netplan.io/reference#examples
|
|
Loading…
Reference in New Issue
Block a user