https://github.com/postman721/Azure_examples
From the above link, you will find a new repository, which contains material related to Azure.
https://github.com/postman721/Azure_examples
From the above link, you will find a new repository, which contains material related to Azure.
Sometimes a need to get variables into your Python code, without hard-coding them into the program itself will arise.
Here is how it can handled.
sudo apt install python3-decouple -y
Add this into your py program’s import lines:
from decouple import config
Next, you need to create .env file and insert variables into it.
touch .env
nano .env
SOME_VAR=some_value
Then in your code, you would refer to your variable like this:
some_var=config(“SOME_VAR”)
With the keyboard, scan and connect via cli:
bluetoothctl
From the [bluetooth], turn on power, turn on agent and start scanning for devices.
[bluetooth] power on
[bluetooth] agent on
[bluetooth] scan on
Next, pair your keyboard:
pair <mac_address_of_the_keyboard>
When you get prompted a code type it with the keyboard that you are pairing and press enter with it.
At this point, I got a pairing success message. This pairing process also worked with the Blueman applet. But for some reason it was not permanent with my Logitech K480 keyboard. When pairing was done via cli it was permanent and survived a computer reboot. I suspect this being because the gui never asked for any pin, whereas the cli did.
Finally from the cli, I connected my keyboard with:
connect <mac_address_of_the_keyboard>
In the end the cli process was so stable and nice, that I ended up pairing and connecting all my devices via it. Blueman that I had used previously, got removed.
When pairing and connecting was done, I needed to get my bluetooth devices connecting from the system’s startup(automatically). Here is a bash script together with a systemd file to accomplish that:
sudo nano /opt/bluetooth.sh
Script content example:
Continue readingWake on Lan is a great functionality to have if for some reason you have issues accessing the power button of your machine.
Generally, wake on lan works on Linux and Windows with modern machines that support it. Wake on lan also needs a wired connection in order to work.
Here is short guide on how to use wake on lan on Debian based distributions and with Lenovo Ideapad laptop.
Note: On many occasions you will need to also enable wake on lan support on Bios. My Asus desktop (Windows) machine required this. In case of my Lenovo Ideapad, there was no Bios entry at all. However, this Ideapad model still supported wake on lan.
sudo apt install ethtool
ip a
For me it was:
2: enp3s0: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
On the very same ip a command you will also locate a MAC address, similar to:
link/ether 11:a1:11:1c:a1:11
See if wake on lan is enabled: sudo ethtool enp3s0| grep Wake-on
When it is enabled you will see something like:
Supports Wake-on: pumbg
Wake-on: g
If you run this command for the very first time, you will more than likely miss the g on Wake-on. To enable wake on lan on the interface(the g letter), execute: ethtool -s enp3s0 wol g
I did not want to do this every time manually. I created a file called wol.service with the following content:
[Unit]
Description=Wake-On-LAN
#After=network.target
[Service]
Type=oneshot
ExecStart=ethtool -s enp3s0 wol g
RemainAfterExit=true
#ExecStop=/opt/foo/teardown-foo.sh
StandardOutput=journal
[Install]
WantedBy=multi-user.target
Then I copied it to right place, enabled it during the system start, and started it on my current session:
sudo cp wol.service /etc/systemd/system/wol.service
sudo systemctl enable wol
sudo systemctl start wol
4. How to wake on Lan
I noticed that only systemctl suspend was something that I was able to use and produce a working wake on lan situation. This will likely vary based on your setup.
In comparison: On Windows hosts, the system needs to be shutdown cleanly and wake on lan will just work.
On another Debian Linux box you can install: sudo apt install wakeonlan
Then you can wake the machine with: wakeonlan 11:a1:11:1c:a1:11
5. Waking with Android or Iphone:
Wake on lan can also be produced with Android or Iphone. I used Wake On Lan by Mike Webb. You can use that app or something else. I will not directly recommend any applications. I suggest that if you want to use your phone as a wake on lan controller, that you will do some investigation of your own and find out what application is best for your device.