Battery life on laptops
To improve your laptop battery life, just do the following:
sudo dnf install tlp tlp-rdw systemctl start tlp systemctl enable tlp
To improve your laptop battery life, just do the following:
sudo dnf install tlp tlp-rdw systemctl start tlp systemctl enable tlp
I find myself doing google everytime I want to search for port number mapping. So, here is a short script to do just that 🙂
#!/bin/bash -
#===============================================================================
#
# FILE: portfind.sh
#
# USAGE: ./portfind.sh
#
# DESCRIPTION:
#
# OPTIONS: ---
# REQUIREMENTS: ---
# BUGS: ---
# NOTES: ---
# AUTHOR: Amit Agarwal (aka),
# ORGANIZATION:
# CREATED: 08/29/2017 19:00
# Last modified: Tue Aug 29, 2017 07:00PM
# REVISION: ---
#===============================================================================
set -o nounset # Treat unset variables as an error
#This is the directory where you have mappings file downloaded
ODIR=/root
ofile=$ODIR/service-names-port-numbers.xml
if [[ ! -f "$ofile" ]]
then
wget http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml -O "$ofile"
fi
which xmlstarlet >/dev/null 2>&1
if [[ $? == 0 ]]
then
echo "xmlstarlet is installed"
else
apt-get install xmlstarlet
fi
#### xmlstarlet el -u service-names-port-numbers.xml
## registry/record - protocol and number
proto=${2:-tcp}
port=${1:-21}
(echo '';sed '1,4d' $ofile) |xmlstarlet sel -t -m "//record[protocol='$proto'][number=$port]" -o "Number(Protocol): " -v number -o '(' -v protocol -o ')' -n -o "Description :" -v description -n
Some distro’s just add all the items under single menu and thus the menu itself becomes unusable because of the number of items in the submenu and this I did not like and hence ceated this simply python script to fix that. For using the script, back up you “menu” file, redirect the output of this script to ‘menu’ file again.
#!/bin/python
F = open("~/.fluxbox/menu", "r")
count=0
mkc=1
started=0
for line in F:
print line.rstrip()
if '[submenu]' in line.lower() and started == 1:
print '[end]'
if '[end]' in line.lower():
count=0
mkc=1
if started > 0:
started=0
# print "Count is {}".format(count)
# print "Started is {}".format(started)
print '[end]'
if '[exec]' in line.lower():
if count > 15 :
if started > 0:
started=0
print '[end]'
# print "Count is {}".format(count)
# print "Started is {}".format(started)
print '[submenu] ({})'.format(mkc)
started=1
mkc+=1
count=0
# print count
count+=1
One of the most written and commented articles has to be Linux vs Windows (of course there are competitors like vim vs emacs) but none has been covered so much as Linux vs Windows. So, what am I going to write here which is not covered earlier in so many other posts. Well a little different perspective 🙂
Continue readingFound a simple method to check for all the packets dropped by kernel.
First you need to install dropwatch with
dnf install dropwatch
and details of the package
- Name : dropwatch
- Arch : x86_64
- Epoch : 0
- Version : 1.4
- Release : 13.fc24
- Size : 27 k
- Repo : fedora
- Summary : Kernel dropped packet monitor
- URL : http://fedorahosted.org/dropwatch
- License : GPLv2+
- Description : dropwatch is an utility to interface to the kernel to monitor for dropped
- network packets.
Continue reading
With the advent of tools like Docker, Linux Containers, and others, it has become super easy to isolate Linux processes into their own little system environments. This makes it possible to run a whole range of applications on a single real Linux machine and ensure no two of them can interfere with each other, without having to resort to using virtual machines. These tools have been a huge boon to PaaS providers. But what exactly happens under the hood?
Continue readingVery quick hack to fix the font hinting automatically. Just execute the below:
sudo ln -s /usr/share/fontconfig/conf.avail/10-autohint.conf /etc/fonts/conf.d/10-autohint.conf
After this you should see the font hinting enabled and thus better experience with fonts.