Nevyan's how to's
Various tutorials from programming to system administration. Topics include docker, javascript, angular, ubuntu, php and many others.
Wednesday, April 10, 2024
Monday, February 26, 2024
Burnout or toxic culture ?
Outsourcing companies are hell to be in for an experienced programmer, because managers are being allowed to mistakes, which are covered, thus putting the rest of the workers in not favourable position.
So it is very important to keep track of your health and please do not try to compensate the toxic workplace effect with: letting it out to other people, overeating not sleeping etc.
Restorative is : running, and weight lifting.
From the herbs I recommend: thyme, glog and passiflora tea to help with the sleep as well as taking ashwagandga.
Take your time and enjoy!
Thursday, April 21, 2022
Simple Laravel REST API
1) Create the user model in models/UserModel.php
php artisan make:model User
2)
create validation for the update requests: php artisan make:request UserUpdateRequest
and for the post request:
php artisan make:request UserPostRequest
create user controller based on the user model: php artisan make:controller UserController --model=User --resource
3) create resources/UserCollection: php artisan make:resource UserCollection
to return user collection and user resource, when required by the user controller.
create UserResource: //expose which fields to be returned in the json response.
4) enable the requests to be performed, and add validation rules when posting and updating information, inside Requests/UserPostRequest.php
php artisan make:request UserPostRequest
for updating info:
6) add routes/api.php in order to redirect /users to the index() method of the UserController.
Cheers!
Wednesday, April 20, 2022
WSL2 - how to make it accessible through outher machines
1) enable wildcard listening address of the app like 0.0.0.0
ss -anpst will show you the on which address/port the app is listening to.
2) use powershell to setup portproxy to forward all the outside requests to the windows machine to land in the WSL2 system:
netsh interface portproxy add v4tov4 listenport=3000 listenaddress=0.0.0.0 connectport=3000 connectaddress=localhost
listenport and listenaddress are on the Windows side.
connectport and connectaddress are on the WSL2 side.
(for a node app the listening port (connectport) is usually 3000, check you app listening port in 1)
verify with: netsh interface portproxy show all
3) open port 3000 on the firewall with:
netsh advfirewall firewall add rule name="WSL2 app" dir=in action=allow protocol=TCP localport=3000
verify from the windows defender firewall, advanced settings, inbound rules.
Cheers !
Thursday, April 14, 2022
NativeScript - IOS Xcode build and development settings
Instructions for MAC M1 instance:
1) Update your package.json with the latest tns-ios version!
2) run from /platforms directory: tns platform remove ios, tns platform install ios
3) tns prepare ios, and follow the settings for:
Xcode 12
build:
and development(emulator):
Keep in mind to change for build the VALID_ARCHS to x86_64, and
for developments to arm64 respectively.
for Xcode 13 build just change the VALID_ARCHS to:
Thursday, April 07, 2022
Install Laravel Sail on Windows
10 Steps to install Laravel Sail and start developing web applications under WSL:
1. from Turn Windows features on and off:
choose Windows subsystem for Linux (WSL) -> and restart the system
2. update the kernel of WSL from https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
3. set the default version to 2: wsl --set-default-version 2
4. install from Microsoft Store: Ubuntu
open Command prompt, and type ubuntu
5. Update the ubuntu system:
sudo apt-update && sudo apt dist-upgrade -y
6. Setup Docker: Install Docker Desktop
Go to Settings(icon) then check: General->Use the WSL2 based engine, as well as
Resources->WSL INTEGRATION-> enable integration with my default WSL distro, check also Ubuntu and restart the Docker Desktop app.
7. run inside Ubuntu: curl -a https://laravel.build/example-app | bash
8. start the containers with: ./vendor/bin/sail up
9. you can browse: 127.0.0.1:80
10. in another terminal of Ubunu run: code .
so that you can edit your files inside Visual Studio Code.
Cheers!
Wednesday, April 06, 2022
Install WIFI on Ubuntu linux via terminal
Steps:
with lsusb we can first see if the device is recognised correctly.
then type: iwconfig then use the Tab key to get to your device name
then edit /etc/wpa_supplicant/wpa.conf
and place there:
network={
ssid="network_id",
psk="encoded_password"
}
(you need to supply your own network_id and encoded_password,
you can get the encoded_password by typing:
sudo wpa_passphrase your_ssid
then type a password
and you'll get sample config file with the encoded password, you can overwrite the original file with.
Next: start the wpa supplicant with:
suto wpa_supplicant -Dnext -iwxl...(wifi interface id) -cwpa.conf
Enjoy!
Subscribe To My Channel for updates
-
Here is how to share your Internet connection in a way that other computers to be able to use it. Happy learning and be sure to check ...
-
Here we will be doing an installation of the development/production environment of PHP and MySQL using Docker under Ubuntu. Here is a full v...
-
Laravel installation under Docker seems a painful experience but at the same time, it is a rewarding learning experience. The following are ...