tag:blogger.com,1999:blog-34265851083682456492024-03-12T21:21:11.322-07:00Santanu's Linux LogBookSantanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.comBlogger36125tag:blogger.com,1999:blog-3426585108368245649.post-50656940268882394942019-12-14T23:44:00.001-08:002019-12-14T23:44:13.795-08:00How to use the nvidia gpu on-demand on ubuntu 19.10 for optimus laptops (a short reminder for myself)<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: inherit;">I am currently on Ubuntu 19.10. I used 'prime-select' to select the 'on-demand' option thus:</span><br />
<br />
<span style="font-family: "Courier New", Courier, monospace;">$ sudo prime-select on-demand</span><br />
<br />
Then rebooted. Now, all programs seem to use the default Intel graphics. To use steam and other programs with nvidia, I run then thus:<br />
<br />
<span style="font-family: "Courier New", Courier, monospace;">$ __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia steam</span><br />
<br />
And then from steam, I can see from my system information that the nvidia gpu is indeed being shown, which is not true (and shows the intel card) without the above options.<br />
<br />
<br /></div>
Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com2tag:blogger.com,1999:blog-3426585108368245649.post-46830635260268235342014-08-04T02:14:00.002-07:002014-08-04T02:14:56.631-07:00Using xdg-mime to set default programs to open certain filetypes in Linux<div dir="ltr" style="text-align: left;" trbidi="on">
Recently I had a need to set xpdf as the default program for opening pdf files instead of evince. I decided to use the command line to achieve this. Turns out that I can do this using xdg-mime.<br />
<br />
To know what is the filetype (in the mime 'language') of pdf files:<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> $ xdg-mime query filetype Programming.pdf
application/pdf
</code></pre>
<br />
Once I know the mime type of pdf files, I can see the default program currently used to open pdf files:<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> $ xdg-mime query default application/pdf
evince.desktop
</code></pre>
<br />
So, now I know that evince is being used as the default pdf file opener, and that there is a desktop file by the name of evince.desktop. The location of this file can easily be found using programs like 'locate':<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> $ locate /evince.desktop
/usr/share/applications/evince.desktop
</code></pre>
<br />
Now I know where such desktop files are kept on my system. After installing xpdf, xpdf.desktop also turned up there (if not it is easy to create such a desktop file). So now I can make xpdf as the default program for opening pdf files using the following:<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> $ xdg-mime default xpdf.desktop application/pdf
</code></pre>
<br />
That's it. Now if I try to click on a pdf file, xpdf is used to open it.<br />
<br />
<br /></div>
Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-58897128412651055902014-07-31T00:10:00.000-07:002014-07-31T00:10:06.039-07:00Making git know about my http and https proxy server<div dir="ltr" style="text-align: left;" trbidi="on">
Following is the general syntax of the commands that will set the http and https proxy servers for git:<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> git config --global http.proxy http://proxyuser:proxypassword@proxyserver:proxyport
git config --global https.proxy http://proxyuser:proxypassword@proxyserver:proxyport
</code></pre>
<br />
For example, if I want to set the http and https proxy servers to 192.168.10.10:3128, then I would use the following command (assuming my proxy server requires no authentication):<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> git config --global http.proxy http://192.168.10.10:3128
git config --global https.proxy http://</code><code style="color: black; word-wrap: normal;"><code style="color: black; word-wrap: normal;">192.168.10.10:3128</code>
</code></pre>
<br />
<br /></div>
Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-65738550662878313862014-06-15T04:10:00.002-07:002014-06-15T04:11:09.718-07:00Go away Desktop icons... again!<div dir="ltr" style="text-align: left;" trbidi="on">
I want my desktop to be clean. That means no icons. Recently I have been trying various window managers, and finally I settled down to i3 for the past few weeks. I love it.<br />
<br />
Today, I just wanted to log into Unity just for change, and found things have changed since I last logged into it. That's strange since I never did this and nobody is using my PC. I was seeing desktop icons!<br />
<br />
I wanted to get rid of those. So I used gsettings to find out 'who' was responsible for this. It turned out to be some program called nemo. The following command:<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> ➜ ~ gsettings list-recursively | grep -i desktop | less
</code></pre>
<br />
turned up, among other things, this:<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> org.nemo.preferences desktop-is-home-dir true
</code></pre>
<br />
So, to set things right, I had to do this:<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> ➜ ~ gsettings set org.nemo.desktop show-desktop-icons false
</code></pre>
<br />
Now, things are right again.<br />
<br />
Now that I think about this, I did play with Cinnamon recently, didn't quite like it, and then forgot all about it. Maybe, this was a result of that adventure... nemo being a part of Cinnamon...<br />
<br />
(Oh, in case anyone was wondering, those command prompts are due to oh-my-zsh that I am using nowadays)<br />
<br /></div>
Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-83589637183944296782014-06-04T02:55:00.001-07:002014-06-04T02:55:55.064-07:00Getting audio volume go beyond 100% in Ubuntu Gnome<div dir="ltr" style="text-align: left;" trbidi="on">
In some videos I find the audio volume to be too low, even after the I turn the volume up to 100%. However, from gnome's sound control, I can see that I can use the mouse to make the volume go beyond 100% so that the audio becomes louder.<br />
<br />
So, I was looking for a command line that would do that for me, so that I can assign that to a keyboard shortcut so that every time I needed louder sound, I would not have to use my mouse to reach out for the gnome sound control.<br />
<br />
I turned out that the pactl command (from pulseaudio-utils package in Ubuntu) can be used for this purpose.<br />
<br />
To make the volume go up by 10%, the command would be:<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> pactl set-sink-volume 0 +10%
</code></pre>
<br />
And to make the volume go down by the same amount, the command would be:<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> pactl set-sink-volume 0 -- -10%
</code></pre>
<br />
(The '--' in the command above is necessary otherwise it is interpreted as a command line option and I get an error. The '--' basically stops the shell from option parsing from that point onward)<br />
<br />
This command allows me go beyond 100%<br />
<br />
Now I have assigned this command to a shortcut key in Gnome and my problem is solved :-)<br />
<br />
BTW, if there are more audio devices, the index may need to be changed from 0 (I have only one, so the index is 0 in my case). More details are available in the 'pactl' and 'pacmd' manual pages.<br />
<br /></div>
Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-83608466044406695632014-05-25T00:51:00.001-07:002014-05-25T00:57:08.417-07:00Solution for: Mouse cursor disappears when starting i3 with gnome-settings-daemon (in Arch Linux)<div dir="ltr" style="text-align: left;" trbidi="on">
In my arch installation, whenever I start the i3 (or awesome) window manager as a gnome-session (which starts gnome-settings-daemon), the mouse cursor disappears. It is there, since I can click on things, but not visible. It is possible that the same problem exists when other window managers are started (other than gnome shell), but I have not tested with other window managers.<br />
<br />
The solution turns out to be to run the following command:<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> gsettings set org.gnome.settings-daemon.plugins.cursor active false
</code></pre>
<br />
That makes the mouse cursor visible again.<br />
<br />
<br /></div>
Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-53268234019427522462014-05-18T20:09:00.000-07:002014-05-18T20:09:08.101-07:00Font settings I used in my Arch Linux install (on USB Pendrive)<div dir="ltr" style="text-align: left;" trbidi="on">
I have the following content in my ~/.config/fontconfig/fonts.conf:<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> <?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<match target="font">
<edit mode="assign" name="autohint">
<bool>false</bool>
</edit>
</match>
<match target="font">
<edit mode="assign" name="rgba">
<const>rgb</const>
</edit>
</match>
<match target="font">
<edit mode="assign" name="hinting">
<bool>true</bool>
</edit>
</match>
<match target="font">
<edit mode="assign" name="hintstyle">
<const>hintfull</const>
</edit>
</match>
<match target="font">
<edit mode="assign" name="antialias">
<bool>true</bool>
</edit>
</match>
</fontconfig>
</code></pre>
<br />
Also, from AUR, I have installed the package 'ttf-win7-fonts-autodownload'.<br />
<br />
Further, I have installed 'ttf-ubuntu-font-family'.<br />
<br />
In Firefox I have installed the "Theme Font & Size Changer" add-on.<br />
<br />
IIRC, that's all I did to get great (at least to my eyes) fonts in my Arch installation.<br />
<br />
By the way, this Arch installation is on a USB pendrive, allowing me to carry my Linux around all the time. <i>Apna Linux Pehen Ke Chalo</i> :-)<br />
<br /></div>
Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-78512452474501761552014-05-18T05:27:00.002-07:002014-05-18T05:27:21.334-07:00Using gsettings to set font preferences in my shiny Ubuntu Gnome 14.04 Desktop<div dir="ltr" style="text-align: left;" trbidi="on">
Instead of using gnome-tweak-tool, this time I have used the command line utility 'gsettings' to set my font preferences in Gnome (Ubuntu Gnome - 14.04). After invoking some 'gsettings set ...' commands, I have the following:<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> ubuntu-gnome@ubuntu-gnome:~$ gsettings list-recursively org.gnome.settings-daemon.plugins.xsettings
org.gnome.settings-daemon.plugins.xsettings disabled-gtk-modules @as []
org.gnome.settings-daemon.plugins.xsettings priority 0
org.gnome.settings-daemon.plugins.xsettings hinting 'full'
org.gnome.settings-daemon.plugins.xsettings overrides {'Gtk/ShellShowsAppMenu': <0>}
org.gnome.settings-daemon.plugins.xsettings rgba-order 'rgb'
org.gnome.settings-daemon.plugins.xsettings antialiasing 'rgba'
org.gnome.settings-daemon.plugins.xsettings active true
org.gnome.settings-daemon.plugins.xsettings enabled-gtk-modules @as []
</code></pre>
<br />
(Note the keys 'hinting', 'rgba-order' and 'antialiasing')<br />
<br />
To know which values are valid for any key, there is the 'range' command. For example, to know what are the possible values I can use for the 'antialiasing' key, I can use the following command:<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> ubuntu-gnome@ubuntu-gnome:~$ gsettings range org.gnome.settings-daemon.plugins.xsettings antialiasing
enum
'none'
'grayscale'
'rgba'
</code></pre>
<br />
That means I can use one of those three enum values for the 'antialiasing' key.<br />
<br /></div>
Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-6114867037331332182014-05-17T05:09:00.002-07:002014-05-17T05:10:29.686-07:00Prevent desktop icons to show up in Unity Desktop (Ubuntu 14.04)<div dir="ltr" style="text-align: left;" trbidi="on">
Just type in the following command at a shell prompt:<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> $ gsettings set org.gnome.desktop.background show-desktop-icons false
</code></pre>
<br /></div>
Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-47649744758240135892014-05-17T05:06:00.002-07:002014-05-17T05:06:26.244-07:00Case Insensitive Autocompletion in Bash<div dir="ltr" style="text-align: left;" trbidi="on">
Today I learnt how to get case insensitive autocompletion in Bash.<br />
<br />
Just put the following line in ~/.inputrc:<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> set completion-ignore-case On
</code></pre>
<br />
That's it. To learn more about what is really going on, the bash and readline manual pages should be read.<br />
<br />
<br /></div>
Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-41344068798254142912014-05-04T08:09:00.000-07:002014-05-04T10:02:26.988-07:00Using Upstart in Ubuntu 12.04 to set screen brightness during boot in Asus Eee PC<div dir="ltr" style="text-align: left;" trbidi="on">
First I wrote a small script in /usr/local/bin to set the brightness to the lowest possible value (the lowest value is plenty bright for my eyes):<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> $ cat /usr/local/bin/set-screen-brightness.sh
#!/bin/bash
echo $1 > /sys/class/backlight/acpi_video0/brightness
</code></pre>
<br />
Then I made the script executable. Next I wrote the following upstart script:<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> $ cat /etc/init/my-brightness.conf
description "Set laptop screen to lowest brightness level"
start on runlevel [2]
script
exec /usr/local/bin/set-screen-brightness.sh 0
end script
</code></pre>
<br />
(My default runlevel (as indicated by running the runlevel command) is 2)<br />
<br />
At the next boot, my screen's brightness is automatically set to the provided 0 value.<br />
<br />
If I wanted to start the 'my-brightness' upstart service anytime, I would simply use the following command:<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> $ sudo service my-brightness start
</code></pre>
<br /></div>
Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-91303243449449962072014-05-04T07:54:00.002-07:002014-05-04T07:54:54.157-07:00Hiding the Unity2d launcher when not in use (Ubuntu 12.04)<div dir="ltr" style="text-align: left;" trbidi="on">
The command to hide the Unity2d launcher when not in use is:<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> gsettings set com.canonical.Unity2d.Launcher hide-mode 1
</code></pre>
<br /></div>
Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-10026213952270158812014-04-30T12:40:00.000-07:002014-04-30T12:40:56.974-07:00Connecting to wifi access point from the terminal<div dir="ltr" style="text-align: left;" trbidi="on">
The following process has worked for me. I simply followed the procedure mentioned in arch linux wiki with a small tip from one of their forum post. So, a big thanks to the Arch community.<br />
<br />
First of all, I am assuming all the wireless drivers are installed and loaded properly. I used the commands: iw, ip, wpa_supplicant for the process. NetworkManager was not used.<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> $ iw dev
phy#0
Interface wlan0
ifindex 3
type managed
</code></pre>
<br />
This gives me the name of the wireless interface: wlan0<br />
<br />
<pre style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;padding:0px;color:#000000;text-align:left;line-height:20px;"><code style="color:#000000;word-wrap:normal;"> $ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc mq state DOWN qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
</code></pre>
<br />
That means my wireless link wlan0 was not UP (otherwise the word UP would be there within <>)<br />
<br />
<pre style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;padding:0px;color:#000000;text-align:left;line-height:20px;"><code style="color:#000000;word-wrap:normal;"> $ sudo ip link set wlan0 up
$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
</code></pre>
<br />
Now, the wlan0 is UP. So, now it is time to find out what access points are available.<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> $ sudo iw dev wlan0 scan | grep SSID
SSID: TP-LINK_POCKET_3020_C50F1E
SSID: Ramananda
</code></pre>
<br />
Ok. I want to connect to the first one. But before that I need to create a wpa_supplicant.conf file with the SSID and Password for the Access Point to which I want to connect.<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> $ wpa_passphrase TP-LINK_POCKET_3020_C50F1E xxxxxxxx > wpa_supplicant.conf
</code></pre>
<br />
Now that the wpa_supplicant.conf file is generated, I can attempt to connect to the access point.<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> $ sudo wpa_supplicant -iwlan0 -c wpa_supplicant.conf
ioctl[SIOCSIWENCODEEXT]: Invalid argument
ioctl[SIOCSIWENCODEEXT]: Invalid argument
Trying to associate with xx:xx:xx:xx:xx:xx (SSID='TP-LINK_POCKET_3020_C50F1E' freq=2462 MHz)
Associated with xx:xx:xx:xx:xx:xx
WPA: Key negotiation completed with xx:xx:xx:xx:xx:xx [PTK=CCMP GTK=CCMP]
CTRL-EVENT-CONNECTED - Connection to xx:xx:xx:xx:xx:xx completed (auth) [id=0 id_str=]
</code></pre>
<br />
I don't know about the ioctl lines, but now I am connected to the wireless access point. Now what I need to do is to use dhclient3 or dhcpcd to get an ip address from my access point (which is also configured as a dhcp server)<br />
<br />
<pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="color: black; word-wrap: normal;"> $ sudo dhclient3 wlan0
</code></pre>
<br />
Done. Now I can successfully ping google :-)<br /></div>
Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-68480601130473275402014-04-30T11:59:00.000-07:002014-04-30T11:59:30.904-07:00Dear Inconsolata, I want to use you properly<div dir="ltr" style="text-align: left;" trbidi="on">
I never got why inconsolata font is considered good for coding and things like that... until today.<br />
<br />
I learnt that if I set autohint=true for the Inconsolata font in Linux (I am currently on Ubuntu 14.04), it actually looks great!<br />
<br />
So, after reading some portions of the fonts.conf(5) manual page, I added the following stanza to my .config/fontconfig/fonts.conf file so that autohinting will be selectively turned on only for the Inconsolata font (others fonts tend to look horrible if autohinting is turned on as far as I am concerned):<br />
<br />
<pre style="font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; color: #000000; background-color: #eee;font-size: 12px;border: 1px dashed #999999;line-height: 14px;padding: 5px; overflow: auto; width: 100%"><code> <match target="pattern">
<test name="family">
<string>Inconsolata</string>
</test>
<edit mode="assign" name="autohint">
<bool>true</bool>
</edit>
</match>
</code></pre>
<br />
<br /></div>
Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-10301639304439040302014-02-10T12:15:00.000-08:002014-02-10T12:22:10.333-08:00Getting the correct pre-requisites for building gcc<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<br /></div>
Today I had to build a gcc cross compiler for my OS related experiments (I was building the bare bone OS as described in <a href="http://wiki.osdev.org/Bare_Bones">http://wiki.osdev.org/Bare_Bones</a>). For some reason, gcc would not build. Turned out the versions of <code>mpc</code>, <code>mpfr</code> and <code>gmp</code> that I downloaded were likely not compatible, and were causing problems. <br />
<br />
After some searching on the net I found that inside gcc source tree, there is a folder called contrib which contains a script called <code>download_prerequisites</code>. So, all I needed to do was to get into gcc source folder and execute:<br />
<code><br /></code>
<code>$ ./contrib/download_prerequisites</code>.<br />
<br />
This downloaded the correct versions of the prerequisites and I was then able to successfully build the i586-elf target gcc cross compiler.<br />
<br />
<br /></div>
Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-68460412976815861232014-01-02T20:44:00.001-08:002014-01-02T20:44:11.401-08:00An excellent source of some nice tutorials <div dir="ltr" style="text-align: left;" trbidi="on">
Today, I was looking for some nice tutorial videos on intel assmbly language, and found this:<br />
<a href="http://opensecuritytraining.info/IntroX86.html">http://opensecuritytraining.info/IntroX86.html</a><br />
<br />
Very informative.<br />
<br />
I think I am going to frequently visit this <a href="http://opensecuritytraining.info/">site</a> for their nice tutorials on some interesting topics which I find interesting.<br />
<br /></div>
Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-83029827566924987812013-12-30T22:16:00.003-08:002013-12-30T23:41:56.046-08:00Sample usage of transcoding using vlc, then genisoimage and wodim to write a dvd<div dir="ltr" style="text-align: left;" trbidi="on">
Today I needed to write a dvd with some old family videos in it. The videos were obtained from my Sony Handycam. They were .MPG files, but the problem was they were too large to fit in a dvd.<br />
<br />
So, to reduce their size without changing the quality, I decided to transcode them using vlc. I had no idea how to do it. So I fired up vlc from a terminal and after exploring some menu items, I transcoded one of the files to .mp4. The size got reduced by more than half. Great! Now I had to find a corresponding command line form of the same action for automating it for transcoding all of the 36 files I had.<br />
<br />
So, I looked at the terminal dump of whatever vlc had done so far, and then googled around a little, and came up with this solution (for my case):<br />
<br />
<code>
for i in `seq -w 01 36`; do </code><br />
<code> cvlc ~/Videos/HomeVideos/2011.10.05/M2U000$i.MPG <br />
--sout '#transcode{ <br />
vcodec=h264,vb=0,scale=0, <br />
acodec=mpga,ab=128, <br />
channels=2,samplerate=44100 <br />
}:std{access=file,mux=mp4,dst='./$i.mp4'}' <br />
vlc://quit; <br />
done <br />
</code><br />
<br />
(BTW, what I actually ran was the above code all in a single loong line. I just formatted the above code to look nice and be more understandable. I am not sure whether the code would work if formatted like above. Too lazy to try now.)<br />
<br />
The <code>vlc://quit</code> was to make vlc quit after transcoding each file. Otherwise I had to press Ctrl-C after each file was transcoded.<br />
<br />
Next I made an iso image out of the transcoded files with the genisoimage as follows:<br />
<br />
<code> genisoimage -o homevideos_2011.10.05.iso \ <br />
-p "Santanu" -V "HomeVideos_2011.10.05" -publisher "Santanu" \ <br />
./converted/ <br />
</code>
<br />
<br />
Then I wrote the resulting iso file to a blank dvd using wodim as follows:<br />
<br />
<code>
wodim -v -eject speed=4 dev=/dev/dvdrw driveropts=burnfree homevideos.iso </code><br />
<code><br />
</code><br />
<code><br />
</code></div>
Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-62449129768134064352013-09-21T05:05:00.001-07:002013-09-21T05:05:20.501-07:00RIP 'q' Key :-(<div dir="ltr" style="text-align: left;" trbidi="on">
Recently, my colleague's thinkpad's 'q' key died. I am now thinking of digging up old xmodmap manual to use an unused key for 'q'. In the meantime, I am using the following method to input the 'q' character in gnome-terminal, firefox, etc.:<br />
<br />
Control+Shift+u, then the hex Unicode value for the 'q' character (71)<br />
<br />
... time to find the xmodmap manual... wait, I think I made a post about this a few years ago<br />
</div>
Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-30138498467426775162013-09-08T21:41:00.002-07:002013-09-08T21:41:54.201-07:00Aircel related info for my future reference<div dir="ltr" style="text-align: left;" trbidi="on">
A few days ago, I had accidentally activated some Aircel service related to SMS (the service is called <b>WBSMS1</b>, the 1 part at the end is probably because it has validity of one day). I don't know what that service was, nor do I care. Since then every day, the service got auto renewed (that makes me angry), costing me Re.1/-<br />
<br />
Today, I finally got fed up with it and try to call customer care number 121. Somehow it seems that I cannot talk to an aircel person using this number. For that I would have to call <b>198</b>. So I called the person at the other end let me know that I am supposed to give the USSD command <b>*122*01#</b> to deactivate the service.<br />
<br />
Tried it and finally the service is deactivated.<br />
<br />
I just wanted to note the process so that I may refer back to it later.<br />
<br /></div>
Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-74612160937473918122013-03-11T19:09:00.002-07:002013-03-11T19:09:21.578-07:00Non-Linux Tip<div dir="ltr" style="text-align: left;" trbidi="on">
To know any VAS (Value Added Services) you have activated on your BSNL mobile, the USSD code to use is <b>*456*00#</b><br />
For Airtel, it is <b>*121*5#</b><br />
<br /></div>
Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-25671055028436615422011-10-13T04:05:00.000-07:002011-10-13T04:08:23.889-07:00RIP Dennis RitchieToday is indeed a very sad day for me. We have lost a great mind. Dennis Ritchie was one of my heroes. RIP Dennis Ritchie.Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-23970092817003752882009-12-19T14:18:00.000-08:002009-12-19T14:52:59.052-08:00Skype in LinuxRecently I have started using Skype in Linux for video calls (calling home). My webcam (Logitech QuickCam Connect) works well in Linux but not directly under Skype (2.1.0.47). I am on Ubuntu 9.10. After some net surfing, I found two solutions that worked:<br /><br /><u>Solution#1:</u><br /> Install gstfakevideo.<br /> If webcam is at <code>/dev/video0</code>, then move it to, say <code>/dev/video1</code> (gstfakevideo will use <code>/dev/video0</code> for itself by default. This also means that in Skype Video settings, <code>/dev/video0</code> is to be selected).<br /> Start Skype as follows:<br /><pre><code>gstfakevideo v4l2src device=/dev/video1</code></pre><br /><u>Solution#2:</u><br /> Install <code>libv4l</code> (in Ubuntu it is libv4l-0).<br /> Start Skype as follows:<br /><pre><code>LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so /usr/bin/skype</code></pre><br />(change the above path names depending on where the libv4l and skype are installed in your system)<br /><br />Now that I got video working under Skype, I faced another problem. The video was too dark, and the current Skype version for Linux does not provide any option to change the brightness, contrast, etc. Again, some net surfing, and the solution that works for me turns out to be <em>xawtv</em>.<br /><br />xawtv includes along with it a tool called v4lctl, which allows one to control brightness, contrast, etc. of the video stream from v4l devices. For me, a simple <br /><br /><code>v4lctl bright 250</code> <br /><br />from the terminal during a Skype video call solved the brightness problem. For other options that can be changed via v4lctl, do a <br /><br /><code>v4lctl list</code>.<br /><br />I can't exactly remember the URLs from where I collected those solutions, but I do remember that all of that info was from the Skype forums.Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-50543190566441139212009-03-22T14:10:00.000-07:002009-03-22T14:26:48.414-07:00Narrowing down to a region in EmacsEmacs is awesome! What a piece of software! Recently, I discovered a very useful feature in Emacs.<br /><br />Let's say, you are writing some documentation in <code>text-mode</code>. Inside it, you need to write a piece of C code with proper indentation. You can switch to <code>c-mode</code>, but then the rest of your text starts looking weird with colors and all, and this is very distracting (to me at least). But Emacs, as usual, has a solution to this problem.<br /><br />Select a few blank lines (where you want to insert your code) within the text, and give the command <code>M-x narrow-to-region</code> (the keyboard shortcut for this is <code>C-x n n</code>). You will find yourself in a buffer with only the region you selected. Then you can enter <code>c-mode</code> and write the code. When done, you can go back to your original full view by using the command <code>M-x widen</code> (or <code>C-x n w</code>) and switch back to whatever mode you were in (<code>text-mode</code> in this case).<br /><br />I find this pretty useful.Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com0tag:blogger.com,1999:blog-3426585108368245649.post-76770303511709195872009-03-22T13:50:00.000-07:002009-03-22T14:10:39.807-07:00Using "Abbreviated Skeletons" in EmacsIn Emacs, you can use code templates (using 'skeleton's in emacs) as abbreviations to speed up your coding. Here is an example:<br /><br />Suppose I want to create a code-template for the <em>for loop</em> in <em>c-mode</em> in Emacs. To create the template, I can put the following function in my <code>.emacs</code> file:<br /><pre><code><br />(define-skeleton c-for<br /> "Inserts a C for loop template."<br /> nil<br /> > "for (;;){" \n<br /> > _ \n<br /> "}" > \n<br /> )<br /></code></pre><br />(see the <em>Autotype</em> section of the emacs info)<br /><br />After that, I can edit the abbreviation table by using the command <code>M-x edit-abbrevs</code> (i.e., Press Alt+x, and then give the command edit-abbrevs and press enter). <br /><br />Then, under the heading (c-mode-abbrev-table), leaving a blank line, I can enter the following line:<br /><pre><code><br />"forst" 0 "" c-for<br /></code></pre><br /><br />Then, I can save the changes by pressing <code>C-c C-c</code> (i.e., press Control+c twice). That's it. <br /><br />Now, whenever I am writing a C program, if I need to use the template, I will just type "forst" (without the quotes), and if the abbrev-mode is turned on, then as soon as I enter a space, my template for the for statement gets entered with the cursor inside the for loop as follows:<br /><pre><code><br />for (;;){<br /> _<br />}<br /></code></pre><br /><br />(If the abbrev-mode is turned off, "forst" can still be expanded to the template by pressing "C-x a e", which basically stands for "<em>a</em>bbreviation <em>e</em>xpand".<br /><br />Oh, of course I need to save my abbreviations using <code>M-x write-abbrevs-file</code> if I want to use them in future emacs sessions. But that is obvious... although I have forgotten that on many occassions :-)Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com2tag:blogger.com,1999:blog-3426585108368245649.post-87614682671705578872009-03-11T08:39:00.000-07:002009-03-11T13:23:11.379-07:00How I connected to Internet from Linux via Airtel GPRSFirst of all, I needed to activate Airtel's MO (Mobile Office) GPRS service. At the moment, they provide a form of this service by which I will be charged @ 30p/50KB (at least that's what I understood from their website). So, here is what I did:<br /><br /><span style="font-weight:bold;">Activating the MO service</span></br><br />Dialed *567*1# to activate (*567*2# to deactivate) the service on my prepaid Airtel connection.<br /><br /><span style="font-weight:bold;">Configuring the mobile</span></br><br />To configure the mobile for the MO service, I needed to set the active GPRS access point to <span style="font-style:italic;">airtelgprs.com</span>. I have a Nokia 3220. There I had to set <code>airtelgprs.com</code> under <span style="font-style:italic;">Settings -> Connectivity -> GPRS -> GPRS Modem Settings -> Edit Active Access Point -> GPRS Access Point</span>. Also, I set the <span style="font-style:italic;">Alias for Access Point</span>, and <span style="font-style:italic;">Active Access Point</span> to <code>airtelgprs.com</code>. That was all I had to do on the mobile side.<br /><br /><span style="font-weight:bold;">Connecting the Mobile to my Linux box</span></br><br />I connected the mobile (Nokia 3220) using the Nokia CA-42 cable to an USB port on my 4 yr old Compaq Presario 2203AL Laptop running Fedora 10. I made sure that the kernel had recognized my mobile as an USB modem. I checked that using the command <code>dmesg</code>. Among the several lines of output, the following lines appeared:</br><br /><pre><code><br />usb 2-2: new full speed USB device using uhci_hcd and address 2<br />usb 2-2: configuration #1 chosen from 1 choice<br />usb 2-2: New USB device found, idVendor=0421, idProduct=0802<br />usb 2-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0<br />cdc_acm: This device cannot do calls on its own. It is no modem.<br />cdc_acm 2-2:1.0: ttyACM0: USB ACM device<br />usbcore: registered new interface driver cdc_acm<br />cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters<br /></code></pre></br><br />Thus, my mobile was detected as an USB modem with device name <code>ttyACM0</code> under the <code>/dev</code> directory.<br /><br /><span style="font-weight:bold;">Linux side configuration</span></br><br />First of all, I made sure that I had turned off my wi-fi connectivity on this laptop. Also, I don't use ethernet on this laptop. So, basically, I got totally offline. All I had to do now was to use <span style="font-style:italic;">wvdial</span> program to connect to the internet via the mobile. For that I needed to create the file <code>wvdial.conf</code> in <code>/etc/</code> directory, and put the following lines in it:</br><br /><pre><code><br />[Dialer Defaults]<br />Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0<br />Modem Type = USB Modem<br />Phone = *99***1#<br />Stupid Mode = 1<br />ISDN = 0<br />Username = "none"<br />Init1 = ATZ<br />Password = "none"<br />Modem = /dev/ttyACM0<br />Baud = 230400<br /></code></pre><br /><br />Once that was done, I ran the command <code>wvdial</code> from a terminal with root privileges. (Of course, later I intend to write a suitable udev rules file so that the permissions of the ttyACM0 device will be set such that I will be able to run wvdial as a normal user.) Connectivity was established, ppp was started, and along with several lines of output from wvdial, I found the following lines of information:</br><br /><pre><code><br />--> local IP address 117.99.41.9<br />--> remote IP address 10.6.6.6<br />--> primary DNS address 202.56.230.5<br />--> secondary DNS address 202.56.250.6<br /></code></pre></br><br /><br />I checked using <code>ifconfig</code> that ppp was up. Also, the command <code>route -n</code> showed that my default gateway was 10.6.6.6 as expected from the above output. I then manually set the nameservers in the file <code>/etc/resolv.conf</code>.<br /><br />That's all I had to do. I could now successfully ping any website, and surf the net, although very slowly... but who cares, it was fun :-)<br /><br />To stop the connection, I just had to stop wvdial by pressing Control-C.Santanu's Linux Loghttp://www.blogger.com/profile/01171841172389842111noreply@blogger.com2