while ! nc -w5 -z 10.0.0.100 22; do echo "hello"; done
search
Friday, February 14, 2020
Thursday, January 30, 2020
Check and modify connection mtu
To check:
Modify temporarily:
Permanently: edit /etc/sysconfig/network-scripts/ifcfg-eth0 file and add:
[root@lxd-node3 ~]# netstat -i
Kernel Interface table
Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
ens10 1450 455 0 0 0 671 0 0 0 BMRU
eth0 1500 28 0 0 0 32 0 0 0 BMRU
lo 65536 0 0 0 0 0 0 0 0 LRU
ifconfig eth0 mtu 1450
MTU=1450
Thursday, January 23, 2020
fedora: Lockdown a kernel version
Fedora typically keeps 3 latest kernel versions. However, what if you want to keep an old specific kernel version which is known to work well with your system?
First, we need to install a dnf plugin that allows us to keep a specific version of any package:
Lets find all available kernel versions for your system:
Install that specific version of the kernel:
And lock it:
To remove the lock:
sudo dnf install python3-dnf-plugins-extras-versionlock
sudo dnf list kernel --showduplicates
sudo dnf install kernel-5.3.7-301.fc31
sudo dnf versionlock add kernel-5.3.7-301.fc31
sudo dnf versionlock delete kernel-5.3.7-301.fc31
Thursday, January 2, 2020
Dell Precision 5540 - Battery drains in sleep mode
Run the following command to check the suspend mode:
If the output looks like this:
It means that very inefficient suspend mode is active (drains battery from 100% to 0 in 9 hours).
To enable "deep" mode, edit file /etc/default/grub and append "mem_sleep_default=deep" to GRUB_CMDLINE_LINUX:
Apply changes:
Restart your laptop and verify changes:
cat /sys/power/mem_sleep
[s2idle] deep
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet mem_sleep_default=deep"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true
sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
$ cat /sys/power/mem_sleep
s2idle [deep]
Monday, December 23, 2019
Increase storage of a lxd container
By default lxd stopped to assign root (disk) device to a container. To modify storage volume of a container add a device like this:
Restart the container to apply changes.
lxc config device add surflyc root disk pool=default path=/ size=15GB
Friday, November 22, 2019
Lxd on Fedora 31
Fedora 31 has started to use cgroups v2 by default. According to Common F31 bugs it doesn't play nice with Docker, lxd and others. To make fedora switch back to the old cgroups:
sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0"
Friday, October 4, 2019
wifi utils
List used wifi frequences
List available channels
List wifi networks
sudo iwlist wlp1s0 scan | grep Frequency | sort | uniq -c | sort -n
iwlist channel
nmcli d wifi
Wednesday, September 25, 2019
Fix isort in vscode for python2
Go to the vscode Python extension folder:
Install latest version that is known to work with python 2:
cd ~/.vscode/extensions/ms-python.python-2019.9.34911
pip2 install -t ./pythonFiles/lib/python --upgrade isort==4.3.17
Sunday, March 11, 2018
python: Django-like testrunner
Django-like testrunner for non-django projects:
#!/usr/bin/env python
import argparse
import collections
import unittest
import sys
def main():
parser = argparse.ArgumentParser(description='Django-like testrunner')
parser.add_argument('specific_test', metavar='', type=str, nargs='?', help='Specifc test')
parser.add_argument("--failfast", action="store_true")
parser.add_argument("--verbosity", type=int, default=1)
args = parser.parse_args()
loader = unittest.TestLoader()
all_tests = loader.discover('.', top_level_dir="./")
suite = unittest.TestSuite()
if args.specific_test:
def walk_tests(tests):
if isinstance(tests, collections.Iterable):
for item in tests:
walk_tests(item)
return
if tests.id().startswith(args.specific_test):
suite.addTest(tests)
elif not str(tests).startswith("test"):
sys.exit("Error in file %s" % tests)
walk_tests(all_tests)
else:
suite.addTests(all_tests)
unittest.TextTestRunner(verbosity=args.verbosity, failfast=args.failfast).run(suite)
if __name__ == "__main__":
main()
linux: List all IP addresses in a network
To list ip addresses of all connected to the network devices, use this command:
nmap -sn 192.168.0.0/24
Subscribe to:
Posts (Atom)