Skip to content

Instantly share code, notes, and snippets.

View yordanoweb's full-sized avatar

Yordano Pascual Rivera yordanoweb

  • Freelancer
  • Las Tunas, Cuba
View GitHub Profile
@yordanoweb
yordanoweb / pre-commit-golang.md
Created April 6, 2024 22:32
Prepare Golang project for pre-commit

Steps to prepare a Golang project for pre-commit stuff

sudo pamac install pre-commit
sudo npm install -g @commitlint/cli @commitlint/config-conventional
vi /root/golang/project/commitlint.config.js
// /root/golang/project/commitlint.config.js

LUA config with some helpers for LunarVim

local lspconfig = require('lspconfig')

-- Detect if in a Go project
local function is_go_project()
  local go_files = vim.fn.globpath(vim.fn.getcwd(), '*.go', true, true)
 local go_mod_file = vim.fn.findfile('go.mod', vim.fn.getcwd())
@yordanoweb
yordanoweb / cmd-brightness.md
Last active January 30, 2024 02:30
Reduce or increase laptop display brightness from command line

Reduce or increase laptop display brightness from command line

Note: Recently my Archlinux distro stop responding to the shortcut Fn+F3 and Fn+F4 for screen brightness adjustment. Then I found this solution at: https://www.ejmastnak.com/tutorials/arch/backlight/.

First, find out the value of your laptop.

cat /sys/class/backlight/intel_backlight/brightness
@yordanoweb
yordanoweb / find-exec-package.md
Created January 24, 2024 16:00
Find the package of executable with Pacman

Find the package of executable

pacman -Qo executable_name_without_path

For example:

@yordanoweb
yordanoweb / fix-dirty-ntfs.md
Created January 17, 2024 16:11
Fix dirty NTFS disk from Linux

Fix dirty NTFS disk from Linux

The problem

Sometimes when try to mount an NTFS disk in Linux, you get at journalctl the error:

ene 17 10:52:55 hp3nvyl17 kernel: ntfs3: sda1: It is recommened to use chkdsk.
ene 17 10:52:55 hp3nvyl17 kernel: ntfs3: sda1: volume is dirty and "force" flag is not set!
@yordanoweb
yordanoweb / get-control-resolve.conf.md
Last active January 12, 2024 04:07
Get full control of resolv.conf

Get full control of resolv.conf

Edit NetworkManager.conf

Open /etc/NetworkManager/NetworkManager.conf and add:

[main]
dns=none
@yordanoweb
yordanoweb / go-win-from-linux.md
Last active December 24, 2023 22:45
Compile Go for Windows from Linux

Install zig

By any means, using default distro package manager, or any other method, install zig. Please, install zig first...

Compile project

CGO_ENABLED=1 \
    GOOS=windows \
 GOARCH=amd64 \
@yordanoweb
yordanoweb / compare-str-cmd-line.md
Created December 11, 2023 19:25
Compare two strings from command line
[ "$string1" = "$string2" ] && echo OK || echo NO
@yordanoweb
yordanoweb / modify-resolv.conf.md
Created November 18, 2023 17:56
Free access to resolv.conf

Check that resolv.conf is inmutable

lsattr /etc/resolv.conf

If it is, the previous command will output something like this:

----i---------e------- /etc/resolv.conf
@yordanoweb
yordanoweb / mysql-useful-queries.md
Created November 1, 2023 18:04
MySQL useful queries

List databases by creation date

SELECT table_schema AS Database_Name, MIN(create_time) AS Creation_Time FROM information_schema.tables WHERE table_schema like 'some_db_name%' Group by table_schema;

List databases with size

SELECT table_schema "DB Name",ROUND(SUM(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB" FROM information_schema.tables GROUP BY table_schema;