Monday, November 9, 2020

AT&T USA | Internet not working | Fix by custom APN

If the AT&T Mobile internet is not working on your cellphone, it can be fixed easily by adding an APN configuration.

You can read this at my Reddit as well.

Go to Settings -> Connections -> Mobile networks -> Access Point Names; Edit an existing APN configuration or create a new one. Save and activate.

An iPhone settings is mostly at

Settings > Cellular > Cellular Data Options > Cellular Network
OR
Settings > Mobile Data > Mobile Data Options > Mobile Data Network.

The config given below worked pretty well on my Samsung Galaxy S10 5G device. It gives around 4.3 mbps download and 1.2 mbps upload.

APN: Phone
Proxy: Not Set
Port: Not Set
Username: Not Set
Password: Not Set
Server: Not Set
MMS port: 80
MCC: 310
MNC: 410
Authentication type: None
APN type: Internet + mms + dun
APN protocol: IPv4/IPv6
APN roaming protocol: IPv4/IPv6
Enable/disable APN: APN enabled
Bearer: Unspecified
Mobile virtual network operator type: none

Thursday, November 5, 2020

Use your stand-by Android or iPhone as Webcam and connect from Linux, Windows or Mac PC

Note: This content is available for read at my Reddit as well.

As the COVID lock-down continues and more people have adopted Work from Home option, the Webcams are running out of stock and the manufacturers are busy selling them at higher prices.

Here's a an easy alternative to use a stand-by Android or iPhone as Webcam using the Phone App and connect from Linux, Windows or Mac PC  using the client software.

I've been looking at DroidCam and iriun webcam as the options. The latter did well in Video resolution, auto-focus and picture quality. However, DroidCam overtook it with lots of desirable features though the video resolution is limited to 720p. You can set it to higher resolution in Linux client by editing /etc/modprobe.d/droidcam.conf.
Example: options v4l2loopback_dc width=1920 height=1080
Hence, DroidCam is the obvious winner.

The Pro version of both these come at around $5. The download links and installation documents are available at dev47apps.com and iriun.com respectively. Let's have a look at the Pros and Cons

DroidCam Pros
Editions: Free – DroidCam and Pro is DroidCamX
Connectivity: WiFi/USB
Connection Profile: Yes. Handy in case of multiple devices
Battery consumption: Relatively low (12% in 30 minutes) as compared to iriun 
CPU heating: Low
Switch Front/Rear camera: Yes
Mirror image: Available in pro version
Auto Focus: Available in Free version
Continuous AF: Available in Pro version
Zoom: Yes, from client
Run the App in background: Available
Auto-Dim Display: Available
FPS Limit feature: Yes
FPS Boost feature (experimental): Available in pro version
WB Control: Available in Free version
Reconnects: Easily
Supported clients: Linux, Windows
HTTP streaming: Yes with TLS and user authentication
LED Flash control: Available in Free version

DroidCam Cons
Video resolution: Limits to 720p in both Free and Pro versions
Mirror image: Not available in Free version
Continuous AF: Not available in Free version
Supported clients: Does not support Mac OS


Iriun Pros
Editions: iriun free (In app purchase for Pro)
Connectivity: WiFi/USB
Switch Front/Rear camera: Yes
Video resolution: 4K video
Mirror image: Image mirroring feature is available in Free version
Auto Focus: Available in Free version
Continuous AF: Available in Free version
Supported clients: Linux, Mac and Windows support
LED Flash control: Available in Free version


Iriun Cons
Connection Profile: No Connection/Device Profile available. The client automatically connects the available device
Battery consumption: Relatively high (18% in 30 minutes) as compared to DroidCam
CPU heating: High
Zoom: Not available
Run the App in background: Not available
Auto-Dim Display: Not available
FPS Limit feature: Not available
FPS Boost feature: Not sure if it’s built-in. Looks like
WB control: Not available
Reconnects: lost connection will require a Screen unlock or App refresh to re-establish
HTTP streaming: Not available

Tuesday, May 10, 2016

Youtube and other video issues in Chrome | Ubuntu

The videos, flash plugins and other high graphic stuff may stop working in Google Chrome.

Symptoms
Videos won't play properly
VLC may misbehave
Audio and Video decoding may not be in sync

Cause
GPU Hardware acceleration is failing. The GPU acceleration is required by many applications like Chrome, VLC, etc.

Workaround
Go to Advanced Settings of Google Chrome and deselect "Use hardware acceleration when available". Be cautious, by doing this - some other graphics also may stop working.

Solutions

  1. Reset the Chrome settings
  2. Clear Cookies and Cache
  3. Ensure that the Java Script is enabled in Chrome
  4. Go to chrome://plugins and ensure that the Adobe Flash Player is enabled
  5. If this doesn't work, try a re-installation of Google Chrome
  6. Check that you have VDPAU library installed VDPAU is an open-source library and API allows to video programs to offload portions of the video decoding process and video post-processing to the GPU video-hardware. 
           $ dpkg -l | grep vdpau

           Install it if not available

                   $ sudo add-apt-repository ppa:nilarimogard/webupd8
                   $ sudo apt-get update
                   $ sudo apt-get install libvdpau-va-gl1

 If it's installed, better upgrade it because you have probably upgraded the kernel and so many other packages and you are using it. This may cause problem in communicating with the VDPAU library properly.

Try opening YouTube in chrome. Follow the below steps if it's not working.

$ sudo mkdir -p /etc/adobe
$ echo "EnableLinuxHWVideoDecode=1" | sudo tee /etc/adobe/mms.cfg
$ echo "OverrideGPUValidation=1" | sudo tee -a /etc/adobe/mms.cfg

To enable the driver for system-wide (not recommended):

$ sudo sed -i "s/^# \[/\[/g" /etc/X11/Xsession.d/20vdpau-va-gl
$ sudo sed -i "s/^# export/ export/g" /etc/X11/Xsession.d/20vdpau-va-gl

Wednesday, August 27, 2014

Xperia Z battery backup

Miracle - Battery backup of my Samsung Galaxy Ace Plus has been increased after disabling/removing some unwanted applications including FB. and that of Sony Xperia has been decreased. Busy in fine tuning Xperia. :-) :-P

Able to get some battery life as of today. Actions done so far.

Disabled and enabled Automatic Account sync.
Upgraded Google Play services to version 5
Disabled custom launchers and switched back to native xperia Launcher
Turned off News application sync
Removed 4-5 unwanted applications 
Ran Clean master a few times
Removed Viber
Removed corrupted files from internal and external cards.
Kept the USB mode to MTP

# Hari I psychotux.com

Sunday, January 19, 2014

GIMP image conversion from Nikon NEF in Windows and Ubuntu

Windows
GIMP - Batch RAW conversion in Windows.... Installed GIMP 2.8, ufraw 0.18 and here we go....

Follow http://registry.gimp.org/node/26260

E:\Personal\Photos\Unix_Outing_17022013>"E:\Programs\GIMP 2\bin\ufraw-batch.exe"
--out-type=jpg --compression=95 *.NEF

Linux - Ubuntu
$ sudo apt-get install gimp
$ sudo apt-get install ufraw
$ sudo apt-get install gimp-ufraw

ufraw-batch --out-type=jpeg  --compression=85 *.NEF

OR

ufraw-batch --lensfun=none --out-type=jpeg  --compression=85 *.NEF

Saturday, November 30, 2013

Tata photon Huawei and MTS ZTE Blaze in Ubuntu 13.04 Wheezy

Before you start

Ensure that you have installed wvdial, usbmodeswitch and usbmodeswitch_data

# dpkg -l | grep wvdial
# dpkg -l | grep modeswitch

Install it from your ISO or any other source. Be careful about the proper version is installed.

Be sure that USB driver modules are loaded.

# lsmod | grep usb

This should show that USB Serial driver is loaded
# usbserial              36911  2 option,usb_wwan

Load it if not.
# modprobe usbserial

Tata photon+ Huawei EC1561 Manufacturer ID 12d1 Product ID 1446

$ sudo su -

Connect your dongle

# lsusb
This should show the device as

Bus 003 Device 009: ID 12d1:140b Huawei Technologies Co., Ltd. EC1260 Wireless Data Modem HSD USB Card

# modprobe usbserial vendor=0x12d1 product=0x1446
# usb_modeswitch -I -W -c /etc/usb_modeswitch.d/12d1\:1446

Run wvdialconf. Then make it to look like the one below. This is a simple configuration. I will show you how to add both Tata Huawei EC1561 and MTS ZTE together at the bottom of this document.

[Dialer Defaults]
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
Phone = #777
ISDN = 0
Username = internet
Init1 = ATZ
Password = internet
Modem = /dev/ttyUSB0
Baud = 9600

Now dial to connect...

# wvdial

That's it - you are now connected to the internet. You can create the Connection in GUI through System -> Preference -> Network connection

The file /etc/usb_modeswitch.d/12d1\:1446 may not exist by default depending on your USB ModesSwitch pkg. Create it with the entries as shown below.

DefaultVendor=  0x12d1
DefaultProduct= 0x1446
TargetVendor=   0x12d1
TargetProduct=  0x1446 
TargetClass=    
TargetProductList="1001,1406,140b,140c,1412,141b,14ac"

DetachStorageOnly=0
HuaweiMode=0
SierraMode=0
SonyMode=0
GCTMode=0
KobilMode=0
MessageEndpoint=  not set
MessageContent="55534243123456780000000000000011062000000100000000000000000000"
NeedResponse=0

Create a file called /etc/modprobe.d/usb-storage.conf with the following entries

options usb-storage delay_use=3

MTS Blaze ZTE Manufacturer ID 19d2 Product ID fffe

$ sudo su -

Connect your dongle

# lsusb
This should show something like

Bus 003 Device 009: ID 19d2:fffe ZTE

# modprobe usbserial vendor=0x19d2 product=0xfffe
# usb_modeswitch -v 0x19d2 -p 0xfffe -H -W



Run wvdialconf. Then make it to look like the one below. This is a simple configuration. I will show you how to add both Tata Huawei EC1561 and MTS ZTE together at the bottom of this document.

[Dialer Defaults]
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Modem Type = Analog Modem
Phone = #777
ISDN = 0
Username = internet@internet.mtsindia.in
Init1 = ATZ
Password = mts
Modem = /dev/ttyUSB0
Baud = 115200

Now dial and connect to Internet

# wvdial

Here is the WVDIAL config for both the devices to work together

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Stupid Mode = 1
Modem Type = Analog Modem
ISDN = 0
New PPPD = yes
Modem = /dev/ttyUSB0
Baud = 9600

[Dialer mts]
Phone = #777
Modem = /dev/ttyUSB0
Password = mts
Username = internet@internet.mtsindia.in
Baud = 115200

[Dialer tata]
Phone = #777
Modem = /dev/ttyUSB0
Password = internet
Username = internet
Baud = 9600

Now you can dial both the Modems

$ sudo wvdial tata

$ sudo wvdial mts

Tuesday, July 23, 2013

Which one do you think the best OS?

Linux
AIX
HPUX
Solaris
AS400
Mac OS
Windows

Monday, March 21, 2011

Accurate calculation of memory utilization in Linux

Hi, We use ps aux | awk '{sum +=$4}; END {print sum}' to find the total memory utilization excluding the buffers and cache. This one manipulates the wrong data at some instances. No idea why  . So in addition to this we can adopt the below commands as wel.. free -m | grep "+" | awk {'print $3/$4*100'} or more handy U=`free -m | grep "+" | awk {'print $3'}`;F=`free -m | grep "+" | awk {'print $4'}`;echo "scale=2;$U/$F*100"| bc There may be another ways as well. Comments please.

Wednesday, January 12, 2011

Check remote UDP connectivity from Linux

Hi there,
You all know how to check TCP port connectivity from a Linux or UNIX machine to a remote machine using telnet as per th example below
$ telnet 127.0.0.1 25

but we can't adopt TELNET to check UDP connectivity.

Linux and most of the UNIXes come with a network layer utility called nc (abbreviation for netcat) which is very useful to check UDP connectivity and to explore a lot with both TCP and UDP.

An example is shown below

# nc -v -u -z -w 3 172.24.16.131 123
Connection to 172.24.16.131 123 port [udp/ntp] succeeded!

Friday, November 12, 2010

Merge a number of files or file contents

#!/bin/bash
# Script to create a CSV formatted text with a file of a few lines having one entry per line.
# This will merge the files line by line

for i in `cat test`; do echo $i > out/$i.out; done;
paste -d, out/*

Sunday, October 17, 2010

Problem with passwordless SSH as ROOT equivalent user

Password less SSH using RSA/DSA public key helps a lot in automated file copying, scripts, cron, etc. but there found a trouble when a root equivalent user will try this mechanism.

It wont work if you just copy/append the public key to remote server's ~/.ssh/authorized_keys. The wrong thing here is when you generate public key it will make one with username root instead of the real user's name since the UID is 0. The hack to be done to fix this is just change the username at the end of the public key in authorized_keys at remote server.

. Change the username entry of Public key at remote location in authorized_keys from root to USER. If you have a single entry in authorized_keys you can run the below command. Otherwise open it in an editor and replace the ROOT with USERNAME for the specific key.

# sed -i 's/root/USER/g' /home/USER/.ssh/authorized_keys

Other general things to be taken care in SSH key mechanism are

· Set user and group of /home/USER to USER

# chown USER.USER –R /home/USER

· Changed the permission of /home/USER/.ssh to 700

# chown 700 /home/USER/.ssh

·
Changed the permission of all files under /home/USER/.ssh to 600

# chmod go-rwx /home/USER/.ssh/*


· Use ssh –i /home/USER/.ssh/id_rsa option for password less authentication

· Restart SSHD.

Tuesday, February 23, 2010

Backup of CRON list and jobs

#!/bin/bash
# Author: haritux.in
# To be ran as root or SUDO
echo Enter the destination directory for backup
read DEST
OUT=`hostname`_crons.`date +%d%m%Y-%H%M%S`
mkdir -p $DEST/$OUT 2&> /dev/null
cd $DEST/$OUT

for i in `ls /var/spool/cron/crontabs/`  ### Debian, Ubuntu
#for i in `ls /var/spool/cron/`  ### Red Hat, CentOS, Fedora
   do 
     grep $i /etc/passwd
     if [ $? = 0 ]; then
        {
        crontab -u $i -l >> $i.cronlist.txt
        }
     fi
   done
cd ..
tar -czf $OUT.tar.gz2 $OUT
rm -rf $OUT

Tuesday, February 9, 2010

SSH Launcher

#!/bin/bash
echo Select the hostname to SSH
HOSTS=/home/psychotux/scripts/conf/hosts.txt
cat $HOSTS | cut -f3 -d'|'
read host
echo Enter your username number
IP=`grep $host $HOSTS | cut -f2 -d'|'`
ssh "$user"@$IP

Note: /home/psychotux/scripts/conf/hosts.txt will be a file with values HOSTNAME and IP ADDRESS separated by "|"

Thursday, December 17, 2009

SED-Replace multiple lines with a single line

A useful option of sed command to replace multiple lines with a single line upon matching a given string.


$ cat -n file.txt
Hello world
Hello nobody
nobody
Somebody
anybody


If you want to replace the lines 2 and 3 with another line "Hello everybody" the below command will help.

$ sed '/nobody$/{N;s/Hello nobody\nnobody/Hello everybody/}' file.txt

$ cat -n file.txt
1 hello world
2 Hello everybody
3 Somebody
4 anybody

SMTP authentication through TELNET

It's common that we use TELNET to port 25 of Mail server to check the connectivity and to ensure the Mail flow.

It's also possible to perform SMTP authentication in TELNET session

$ telnet yourmailserver 25
type “HELO”, hit Enter.
AUTH LOGIN


Now you have to enter your email ID and then your password encoded in BASE64.
For converting your email and password to Base64 use the conversion tools at WebPan or Ostermiller

Reference
WebPan.com
KongTechnology

echo colourfully

# for i in `cat num.txt`; do echo -en '\E[3'$i'm'"\033[1mPsycho Tux\033[0m " ; done;
# for i in `cat num.txt`; do echo -en '\E[47;3'$i'm'"\033[1mPsycho Tux\033[0m " ; done;


# cat num.txt
1
2
3
4
5
6
7
8
9
0

Block direct SSH to root, but not to root equivalent

The PermitRootLogin no option of /etc/ssh/sshd_config will block all the users with UID 0. Below is an option to overcome this.

# vi /etc/ssh/sshd_config

###PermitRootLogin no
AllowUsers newuser guest psychotux hari
DenyUsers root

# /etc/init.d/sshd restart


Here users listed along with AllowUsers can be normal user or root equivalent.

Thursday, December 10, 2009

Hardware clock failure in ISA system

In ISA systems /sbin/hwclock will fail to fetch the Hardware clock and will throw an error similar to below.
# hwclock
select() to /dev/rtc to wait for clock tick timed out

# hwclock --show
select() to /dev/rtc to wait for clock tick timed out

But the --directisa option of hwclock will work here.
# /sbin/hwclock --directisa

So as a permanent solution we can rename the existing binary /sbin/hwclock and create a new Wrapper as below

1. Find the version of hwclock
# hwclock --version
2. Rename the binary by suffixing the version number
# cd /sbin
# mv hwclock hwclock-x.y
3. Create a wrapper for the hwclock-x.y named hwclock
# cat > hwclock << HERE
#!/bin/bash
/sbin/hwclock-x.y --directisa \$@
HERE

4. Give necessary execute permission and reboot the server
# chmod +x hwclock
5. Check the hardware clock, System Time, NTP, etc.
To synchronize system time with Hardware clock we can use hwclock --hctosys

And an optional reboot
# reboot

If your system is not ISA the we can try the RTC driver as well. The first thing we have to ensure is the RTC driver is loaded using the below steps.
# lsmod|grep rtc
This will show something like below
rtc 15329 0

If you are not getting any, then the rtc driver has not loaded. You need to load it

# modprobe rtc

Monday, April 27, 2009

Basic Linux Configuration backup

#!/bin/bash
# Title: Linux Primary Configuration Backup
# Version: 1.5
# Last update: 06-08-2012
# Author: Hareesh V V
# E Mail: tux.psycho@gmail.com
# Web: http://www.psychotux.com

DATE=`date +%d%m%y`
BKP=~/`hostname`.BACKUPS_$DATE
/bin/mkdir -p $BKP

tar -cjf $BKP/etc_$DATE.tar.bz2 /etc
/sbin/ifconfig > $BKP/ifconfig
/sbin/route -n > $BKP/route
/sbin/runlevel > $BKP/runlevel
/sbin/chkconfig --list | grep 3:on > $BKP/chkconfig_init_3
/sbin/chkconfig --list | grep 5:on > $BKP/chkconfig_init_5
/bin/hostname > $BKP/hostname
lsmod > $BKP/lsmod
cat /etc/hosts > $BKP/etc_hosts
cat /etc/resolv.conf > $BKP/etc_resolv 
cat /etc/grub.conf > $BKP/grub_conf 
#crontab -l > $BKP/crontab
/sbin/iptables -L  > $BKP/iptables_filter
/sbin/iptables -t nat -L > $BKP/iptables_nat
/sbin/iptables-save > $BKP/iptables
cat /etc/sysconfig/iptables-config > $BKP/iptables-config

/bin/netstat -ntpl > $BKP/netstat
mount > $BKP/mount
fdisk -l > $BKP/fdisk
cat /etc/rc.local > $BKP/rc_local
cat /proc/sys/net/ipv4/ip_forward > $BKP/proc_ip_forward
cat /proc/cpuinfo > $BKP/proc_cpuinfo
getenforce > $BKP/getenforce
cat /etc/fstab > $BKP/fstab
cp -r /etc/sysconfig/network-scripts $BKP/
cat /etc/sysconfig/network > $BKP/network
echo $PATH > $BKP/path

## Hardware
/usr/sbin/hwinfo

/sbin/lspci > $BKP/lspci
/usr/bin/lsb_release > $BKP/lsb_release
/usr/sbin/dmidecode > $BKP/dmidecode
/usr/bin/getconf LONG_BIT > $BKP/getconf
/usr/bin/systool > $BKP/systool
/usr/bin/lshal > $BKP/lshal
/sbin/lsusb -t > $BKP/lsusb
/usr/sbin/biosdecode > $BKP/biosdecode
lshw > $BKP/lshw
cat /proc/version > $BKP/version
cat /etc/printcap > $BKP/printcap
dmesg > $BKP/dmesg
cat /etc/sysconfig/hwconf > $BKP/hwconf


## CRON Backup
mkdir $BKP/`hostname`_crons
cd $BKP/`hostname`_crons
OUT=$BKP/`hostname`_crons
> crons.txt
> $OUT/cronlist
for i in `ls /var/spool/cron/`
do
   grep $i /etc/passwd
   if [ $? = 0 ]
   then
                {
                 crontab -u $i -l >> $OUT/$i.cron
crontab -u $i -l | grep -v "^#" | sort | uniq | awk {'print $6'} >> crons.txt
crontab -u $i -l | grep -v "^#" | sort | uniq | awk {'print $7'} >> crons.txt
                 crontab -u $i -l | grep -v "^#" | sort | uniq | awk {'print $8'} >> crons.txt
                }
   fi
done

for i in `cat crons.txt`
do
  cp $i $OUT 2> /dev/null
done
cd
tar -cjf $OUT.tar.bz2 $OUT
tar -cjf $BKP.tar.bz2 $BKP
cd $BKP/`hostname`_crons
rm -rf crons.txt $OUT
rm -rf $BKP

Sunday, March 8, 2009

Script to find normal users above UID 500

Script to find normal users above UID 500 and their Shell History. This works in Linux. Other NIXes may require modification.


#!/bin/bash
USERS=`grep ":5*:*:" /etc/passwd | grep "/bin/bash" | awk -F: '{print $1}'`
HOME=`grep ":5*:*:" /etc/passwd | grep "/bin/bash" | awk -F: '{print $6}'`
for i in $USERS
do
egrep -i "reboot|init|shutdown|halt|poweroff" `grep $i: /etc/passwd | cut -f6 -d:`/.bash_history
done

AT&T USA | Internet not working | Fix by custom APN

If the AT&T Mobile internet is not working on your cellphone, it can be fixed easily by adding an APN configuration. You can read this a...