Categories
Linux Uncategorized

server

nmcli device show
Categories
apple debian Ubuntu

remove running process

service running when it is not supposed to.

especially web servers called from vscode and not killed afterwards:

lsof -i :<PORT>

lsof lists pid and port.

Categories
Homebridge

Homebridge on Pi Zero

Messing around with homebridge and I had an error Failed to check registry.npmjs.org for updates: “timeout of 10000ms exceeded”

on reddit:https://www.reddit.com/r/homebridge/comments/11j1bmm/failed_to_check_registrynpmjsorg_for_updates/

thanks to Metatropico, he suggested to turn off IPV6 and that solved that issue, thanks!

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1

Categories
Git

Git Branch update with new code

These commands are useful for the following scenario:

Created branch mergeTypeDefs

build code and checked in

Created branch mergeResolvers using code checked out from mergeTypeDefs

went back to mergeTypeDefs and updated the code.

to update the mergeResolvers branch, the following commands were required:

git checkout mergeResolvers
git merge mergeTypeDefs
Categories
Mariadb

mariadb user and permissions

grant privileges. here are some good commands to remember:

create user `airports`@`localhost` identified by 'my-password'
grant usage on airports.* to `airports`@`localhost`;
grant all privileges on `airports`.* to `airports`@`localhost`;
select user,host from mysql.user where user like 'airports';
+----------+-----------+
| User     | Host      |
+----------+-----------+
| airports | %         |
| airports | localhost |
+----------+-----------+
flush privileges;
debugging:
select user()
select current_user()

Categories
golang Mariadb

Go mysql config

I found that when using mysql.Config, I need to add AllowNativePasswords: true for a connection to mariadb from my go program

 30 cfg := mysql.Config{
 31         User: os.Getenv("DBUSER"),
 32         Passwd: os.Getenv("DBPASS"),
 33         Net: "tcp",
 34         Addr: "172.18.0.6:3306",
 35         AllowNativePasswords: true,
 36         DBName: "recordings",
 37     }
 ...
 42 db, err = sql.Open("mysql",cfg.FormatDSN())

Categories
golang

golang dependencies

when I build a module locally, I need to adjust the location in the calling modules go.mod file using the local directory structure relative to the calling modules location. example below:

$ go mod edit -replace=example.com/theirmodule@v0.0.0-unpublished=../theirmodule
$ go get -d example.com/theirmodule@v0.0.0-unpublished

More info here…

/https://go.dev/doc/modules/managing-dependencies#naming_module

Categories
Uncategorized

Rants

CMake

On and off, over the years, I really tried to like cmake. “It does everything! It does it fast It finds libraries for you!”.

CMake is not special. It is yet another bloated tool that requires way too many hours of reading documentation to find out how best to use it. Just tried to add postgres library libpq to work with my c++ program. The documentation said, oh, just use find library postgresql.

yeah.

If you cannot get a tool to work for you within a reasonable amount of time, get rid of it. Cmake is now off my system and I am not looking back.

Categories
Docker postgres

Postgres docker import data

To load a csv file into a table, one way to do it is to use the docker cp command to copy the file into the container. You can then run the \copy command from a cmd line in the container.

docker cp ./projects.csv  some-postgres:/projects.csv
docker exec -it some-postgres psql -U postgres
** from psql:
postgres=# \copy projects(id,project_name,description) from '/projects.csv' csv header;

Categories
apple

iphone autocorrection OFF

Being a new iphone user, autocorrect was a nightmare. great article to turn that crap off yet still get offered correct spelling

https://www.pcmag.com/how-to/autocorrect-fails-tweak-iphone-pad-keyboard-settings