Place of Vega
My place to hang out when I feel like writing something
Friday, March 15, 2013
Saturday, September 29, 2012
Remapping keys on Ubuntu using xmodmap for DotA
Just thought about playing DotA on Ubuntu using wine. The spell keys were easily set using customkeys generator(http://www.drjones.dk/customkeys/generator.php) but missed autowarkeys for setting key mappings for inventory items. After some surfing found out that xmodmap in ubuntu is the stuff i need.
All i needed for my default mapping of space to num7 and capslock to num8 was the 2 lines:
All i needed for my default mapping of space to num7 and capslock to num8 was the 2 lines:
xmodmap -e "keycode 65 = space KP_7 space space space nobreakspace"
xmodmap -e "keycode 66 = Caps_Lock KP_8 Caps_Lock Caps_Lock Caps_Lock nobreakspace"
and when I am done with it just restore them back using
and when I am done with it just restore them back using
xmodmap -e "keycode 65 = space space space space space nobreakspace"
xmodmap -e "keycode 66 = Caps_Lock Caps_Lock Caps_Lock Caps_Lock Caps_Lock nobreakspace"
Instead of typing out the long commands every time, it is easier to put the lines in a shell script in ~/bin
Instead of typing out the long commands every time, it is easier to put the lines in a shell script in ~/bin
Thursday, February 23, 2012
Setting up vidalia on ubuntu
Almost all colleges have some sort of censoring on their Internet service. Many sites like facebook, youtube etc tends to be blocked. A solution to this problem is to use the tor network. Polipo makes pages load faster on slow networks and since tor is not so fast, it is good to set up polipo as well. Here are steps to do it in ubuntu
- Install vidalia and polipo
sudo apt-get install vidalia
sudo apt-get install polipo
- Open config of polipo
sudo gedit /etc/polipo/config
- Add/uncomment these lines
socksParentProxy = "localhost:9050"
socksProxyType = socks5
- Do this if you use proxy to access Net. Go to settings and network. Tick I use a proxy to access the internet and fill in the details.Remove tor from startup by doing
sudo update-rc.d tor disable
& restart. - Start tor. First run takes longer but later it'll connect faster. When it turns green, it means that the network is connected.
- Open your browser's settings where you normally give your proxy address. Give the address as 127.0.0.1 and port as 8123
- That's it. Happy surfing.
Monday, February 20, 2012
bc - the commandline calculator
PS: This is an old post. Waste of time. Get python.
As most of the linux users already know, there is a command line calculator (actually, its a scripting language) in linux that can be invoked from the shell by typing bc. It is an arbitrary precision calculator that can calculate such huge numbers like 2^1000 and print it correctly to the last digit.
It supports the operators +,-,*,/ & ^(exponentiation). It has a minimal math library that can be accessed by a -l option. But it only supports 6 functions: sine,cosine,ln, atan, e^x and Bessel's function.
But most of the other functions can be calculated using these functions by the help of a few mathematical identities. Here is a code snippet I use to increase the utility of bc.
To use it put it in a text file in your home directory and save it as "lib". From terminal, change to home and type
bc -l lib
Now you can use the functions: sin(), cos(), tan(), ln(), log10(), atan(), asin(), acos() and factorial(). You can implement your own functions too. Just look up info bc on terminal. The syntax of bc is almost same as that of C, so if you know C its easier to learn bc.
For windows users, bc is available from http://sourceforge.net/projects/gnuwin32/files/bc/1.06-2/bc-1.06-2.exe/download
PS: This is an old post. Waste of time. Get python.
As most of the linux users already know, there is a command line calculator (actually, its a scripting language) in linux that can be invoked from the shell by typing bc. It is an arbitrary precision calculator that can calculate such huge numbers like 2^1000 and print it correctly to the last digit.
It supports the operators +,-,*,/ & ^(exponentiation). It has a minimal math library that can be accessed by a -l option. But it only supports 6 functions: sine,cosine,ln, atan, e^x and Bessel's function.
But most of the other functions can be calculated using these functions by the help of a few mathematical identities. Here is a code snippet I use to increase the utility of bc.
pi=3.141592653589793
#s(x) is sine in standard math lib
define sin(x)
{ return (s(x)); }
#c(x) is cosine in standard math lib
define cos(x)
{ return (c(x)); }
define tan(x)
{ return (s(x)/c(x)); }
#l(x) from std math lib
define ln(x)
{ return (l(x)); }
define log10(x)
{ return (l(x)/l(10)); }
#a(x) from standard math lib
define atan(x)
{ return (a(x)); }
define asin(x)
{
if(x==1)
return (pi/2);
if(x>=0)
return (a(x/sqrt(1-x^2)));
if(x==-1)
return (-1*pi/2);
if(x<0)
return (-1*(a(x/sqrt(1-x^2)))); }
define acos(x)
{ return (pi/2-asin(x)); }
define factorial(x)
{ i=1; prod=1;
for(i=1;i<=x;i++)
prod=prod*i;
return (prod);
}
#s(x) is sine in standard math lib
define sin(x)
{ return (s(x)); }
#c(x) is cosine in standard math lib
define cos(x)
{ return (c(x)); }
define tan(x)
{ return (s(x)/c(x)); }
#l(x) from std math lib
define ln(x)
{ return (l(x)); }
define log10(x)
{ return (l(x)/l(10)); }
#a(x) from standard math lib
define atan(x)
{ return (a(x)); }
define asin(x)
{
if(x==1)
return (pi/2);
if(x>=0)
return (a(x/sqrt(1-x^2)));
if(x==-1)
return (-1*pi/2);
if(x<0)
return (-1*(a(x/sqrt(1-x^2)))); }
define acos(x)
{ return (pi/2-asin(x)); }
define factorial(x)
{ i=1; prod=1;
for(i=1;i<=x;i++)
prod=prod*i;
return (prod);
}
To use it put it in a text file in your home directory and save it as "lib". From terminal, change to home and type
bc -l lib
Now you can use the functions: sin(), cos(), tan(), ln(), log10(), atan(), asin(), acos() and factorial(). You can implement your own functions too. Just look up info bc on terminal. The syntax of bc is almost same as that of C, so if you know C its easier to learn bc.
For windows users, bc is available from http://sourceforge.net/projects/gnuwin32/files/bc/1.06-2/bc-1.06-2.exe/download
PS: This is an old post. Waste of time. Get python.
Hello World
This is my first post in my first blog. I am a Computer Science student @ (I)IT-BHU, Varanasi, UP , India. So there it is
"Hello World!"
PS:I really hope I won't get bored and quit blogging
"Hello World!"
PS:I really hope I won't get bored and quit blogging
Subscribe to:
Posts (Atom)