Planet Ubuntu Nepal

February 28, 2010

Ishwor Gurung

Bound vs. Unbound Erlang variable, posted Feb. 28, 2010

A pretty decent definition of bound vs. unbound variable. A very good Erlang book is at http://learnyousomeerlang.com/; the author of the book hangs around at #erlang@freenode and overall, he's a great guy who helps folks with problems in Erlang.

http://learnyousomeerlang.com/static/img/un-bound.png

On that note, Erlang is a powerful functional language with the following features:

  • Shared-nothing memory architecture - we don't have to worry about resource locking scheme (deadlock/livelock) since nothing is shared. If you need to name a variable twice use a different variable name.
  • Asynchronous message-passing - means decent performance on multiple cores within an Erlang cluster and worry free variables (they don't need supervisory locks to monitor their state because again it's not shared! :)
  • Functional language properties - A high-order function for control abstractions, anonymous functions and lambda expressions(in spirit of Python)
  • OTP and libraries - Running network applications with about 10 lines of server code and about 6 lines of client code is awesome. I've never seen something like it honestly; Or what about full-on binary IP packet matching (what some folks call packet sniffing) in less than 10 lines?
  • Full-on Exception model - try/catch/throw semantics (like Java)
  • Hot-swappable code on live systems - That code path shouldn't excecute after these conditions are met. Instead load a new set of code that I am updating right-now (say a new set of beam files).
  • Mnesia - Database for Erlang. It was actually called "Amnesia" but Joe's boss at the time in Ericsson didn't particularly like a database name that forgets things so they renamed it.
  • Networking - It's convenient to write BSD-style socket apps in Erlang.

During my university days, I did a bit of Prolog and Lisp too, so i've found that it fits really well with my mental model especially the concept of head and tail while running pattern matching on an function argument classic. It's like saying - "oh well, i did that at school but i almost completely forgot. Why didn't I think of that before?". About a year ago, an Erlang programmer said to me something like this on the #erlang@freenode - "You know you've found Erlang at an early age, you're lucky!". I think I somewhat know why now. I have yet to learn the "fault-tolerant" part of it as I am still going through the book but surely in due time I'll have figured out this as well.

Joe Amstrong's example on Concurrency from the Erlang book is:

We don't have shared memory. I have my memory. You have yours. We have two brains, one each. They are not joined together. To change your memory, I send you a message: I talk, or I wave my arms. You liten, you see, and your memory changes; However, without asking you a question or observing your response, I do not know that you have received my message.

I think Joe is proving more right. Erlang is coming up quickly as the top 20 programming language on TIOBE list and the reasons are pretty clear - we can not just keep adding more hardware and expect a sane performance with concurrency and management. Even with that hindsight in mind, not all the programming languages support running code on multiple cores. Python has trouble with threads deep within it's core - the GIL or the Global Intepreter Lock and I think Ruby even resorts to native threads (oh no!). Contrast that with Erlang - a nice set of green thread that run on VM (like Java). You want 1,000,000 threads? No problem. How about 2,000,000 threads? Yep no problem either! I am not an SQL guru but it seems a lot could be weilded if Erlang was met with NoSQL. I have no experience whatsoever in that department so i'll leave it upto fellow readers of this post.

February 28, 2010 10:56 AM

February 27, 2010

888

Worth Reading 'Funny Hacker Story'


shut up i hack you

ok, i’m quiet, hope you don’t show us how good a hacker you are ^^

tell me your network number man then you’re dead

Eh, it’s 129.0.0.1

or maybe 127.0.0.1

yes exactly that’s it: 127.0.0.1 I’m waiting for you great attack

in five minutes your hard drive is deleted

Now I’m frightened

shut up you’ll be gone

i have a program where i enter your ip and you’re dead

say goodbye

to whom?

to you man

buy buy

I’m shivering thinking about such great Hack0rs like you

* bitchchecker (~java@euirc-61a2169c.dip.t-dialin.net) Quit (Ping timeout#)
More is in here.http://whatthehell.eu/hacker-story

by noreply@blogger.com (Techs Palace) at February 27, 2010 03:46 AM

February 26, 2010

Bibek Shrestha

Don't think

Don't think

Thinking makes you weak,
thinking makes you strong,
thinking makes you unhappy,
thinking brings you joy

And if emotion is the drunk husband, thought the cunning wife.
 

by bibekshrestha at February 26, 2010 06:31 PM

No title

"Good Night" is sufficient to her. She's doesn't ask for more or does she complain. She is like a small drizzle, its enough for her. For me, I want to love the drizzle but if she knew I thrive on a heavy downpour. I want to get wet, no I want to drown. I wonder if the drizzle will ever fullfill.

I wouldn't judge myself, or so I think. I am unhappy and unsatisfied. Wishing for the monsoon, only if life a cyclic season.

by bibekshrestha at February 26, 2010 06:22 PM

Jwalanta Shrestha (jwala)

Internet Connection Sharing in Linux over Ad-hoc Wireless

Laptops are common these days and so is wireless networking that comes with it. Almost all of us use Wireless Router for wireless networking and internet sharing. But most of us might not be familiar with ad-hoc mode that works in every wireless card and can eliminate the use of router altogether. Here's how:

To setup ad-hoc wireless, you basically set two or more wireless cards to same ESSID in ad-hoc mode and different IP addresses.

Setting the wireless card in ad-hoc mode

Generally iwconfig is used to set the wireless mode, but if you have madwifi drivers (see this too), the commands are slightly different. Go to terminal and type,
iwconfig
If you see interfaces named wlan0, wlan1, etc iwconfig will work. If you see interface names similar to ath1 and wifi0, then madwifi specific commands are to be used.

For general wifi cards:
sudo iwconfig wlan0 mode ad-hoc
Replace wlan0 with the interface name as listed by iwconfig

For cards using madwifi driver:
sudo wlanconfig ath1 destroy
sudo wlanconfig ath1 create wlandev wifi0 wlanmode adhoc
Now set essid. Pick some name like 'adhocwifi'
sudo iwconfig wlan0 essid adhocwifi
If required, to set encryption key
sudo iwconfig wlan0 key 1234567890
Now set IP address:
sudo ifconfig wlan0 192.168.0.1
Follow the above steps for another wireless card and set IP address in same subnet, say 192.168.0.2, and ping each other.

The whole ad-hoc mode setting can also be done using GUI network-manager, but since i'm not so much fond of graphical interface i'm not covering it. It should be simple.. :)

Internet Connection Sharing

Now to share the internet over wireless,
sudo iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
where ppp0 is the connection you want to share (PPPoE connection in this case)

You also need to enable IP forwarding:
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
Or, to enable permanently add the following line to /etc/sysctl.conf
net.ipv4.ip_forward=1
Some ISPs might limit the TTL so that you wont be able to share the internet. Fix:
sudo iptables -t mangle -A PREROUTING -j TTL --ttl-inc 1

Using the shared internet (in Linux)

Now to use the shared internet on another computer, set it to ad-hoc mode and assign IP address in the same subnet as described above and perform the following:

1. Set the IP of computer sharing internet as gateway
sudo route add default gw 192.168.0.1
2. Set DNS server. We're using Google's DNS.
sudo sh -c "echo 'nameserver 8.8.8.8' >> /etc/resolv.conf"
You can also use IP and DNS Masquerading to ease the task.


Using the shared internet (in M$ Windows)

If you want to use the shared internet on M$ Windows,

1. Connect to the Wireless Network (in this case 'adhocwifi')
2. Go to Network Connections
3. Right click the Wireless Connection
4. Select the Internet Protocol (TCP/IP) and click Properties
5. Set IP to 192.168.0.2 (or accordingly in the same subnet as set on Linux box), gateway to 192.168.0.1 (as set on Linux box) and DNS to 8.8.8.8

by Jwalanta Shrestha (noreply@blogger.com) at February 26, 2010 02:28 AM

February 24, 2010

Surmandal

Phishing, A small note

PHISHING

Phishing is not a Security Flaw, not even you got Hacked/screwed. This is just a trick phishers use to steal/collect the username/Password, Credit card information and Other crucial information from Victims. This is a technique  of online identity theft. and this is totally preventable but you have to be more careful. phishers can infect computers with viruses, bots, malwares, spywares and convince people to participate unwittingly in money laundering. The most Reliable source of Phishing is spoof email. This message looks like it came from original source. it looks like very authentic and make people to reveal them to disclosed their personal information. Although there are many way, which phisheres used to process, to collect the data, Initially they decide the target company, business house and collect the email address of customers who are associated with that business house. mostly they use mass-mailing and other address collection technique, which adopted by other Spammers.
Then after they setup a method to deliver the message to collect the data. often, this includes email(html based mail), web-site, DNS poisoning, tempering HOST file, pharming and many others technique, but email is most reliable technique to the date.

In third Phase, Phishers send a fake/phony message that appears to be from a authentic source. Then they start to collect the data/information which victims enter into website/pop-up and whatever the link sent in steps 3.

Last but not least, Phishers use these information as they want to. there has been many changes phishing technique since 1996 (I believe the term “Phishing” was mention in 1996 in 2600, A security newsletter). Nowadays URL shorten service like bit.ly play the role of catalyst to spread the phishing scam. user can not figure out, where the link is redirecting to.

Phishing Vector: To accomplished the phishing attack successful these are the method that is used widely
• Man-in-the-middle Attacks:- For man-in-the-middle attacks to be successful, the phishers must be able to re-direct the user to their proxy server instead of the real server. This may be carried out through a Transparent Proxies,DNS Cache Poisoning,URL Obfuscation(As I mention earlier Bad domain names,Friendly login URL,Third-party shortened URL,Host name obfuscation). This is a scenario of MITM Attack

User <–> Attacker’s Proxy <–> Real Website

• Cross-site Scripting/XSS Attacks
• Pre-set Session Attacks
• Observing Customer Data
• Client-side Vulnerability Exploitation

Above technique are the methods/way of, how Phishers Attack and collect the information from victims. I have been involved some Phishing fraud cases in Nepal. after investigation, what I found is all the source was not from Nepal but phishers used Nepal based server to host the Fraudulent site. and interesting fact is all the server was Linux based distribution. I am not saying that Linux is easy to screwed but during the investigation, I found these is lack of strong System administration, lack of auditing, lack of regular monitoring.

Treatment/Preventing method

To prevent from phishing, I have chopped it in 3 parts

1. Client End:- End User Computer security is more poor that enterprise/corporate Workstations. however we can make it more secure. Use of Local Anti-Virus/Personal Firewall/Personal IDS/Personal Anti-Spam/Spyware Detection software, although these software may cut your budgets. and yes installing Anti-Phishing Plug-ins on internet browser would be another good idea.User application-level monitoring solutions,Locking-down browser capabilities,Digitally signed email is yet another secure way to get rid of phishing email and lastly End User awareness. If you get an email that warns you that an account of yours will be shut down/suspend unless you reconfirm billing information, Please Please do not reply that mail or click on the link
in the email. If you get such mail, you can contact the company instead. Never respond the HTML based Email. before submitting the financial information to/from web, always look on “LOCK” sign, that sign refers that your transaction is secure. you can also click on that icon and review the SSL certificate that has been received and issued by a trusted certificate authority. last but not least do not forget to review the bank statement, credit card statement after any financial transaction.

2. Server End:- From the server end, we can implement intelligent anti-phishing application to secure the web applications. always update the message to user/customer how phishing can be done and how to prevent them. post the pages/email address so that users/customers can send the abuse report if they found and do quickly response to them. post the message that company will never send HTML based email and ask them to do not response it, also ask customer to forward that type of mail to the company. you can go for your own customized web application, of-course, for that you need skilled manpower and budget. never forget that security is major concern. another things that should be take care is never used IP address as a URL. always use fully qualified Domain name. for example use www.sarojlamichhane.com.np instead of 202.79.32.251.

3. Enterprise End:-Business house and Internet Service Providers may lead the leading role to prevent the phishing scams. from ISP, their security model works in client side and server side security mechanism. use of digitally signed email, proper monitoring of corporate domain, its expiry date and registering similar type of domain. Business houses should implement Gateway Anti-virus, Gateway Content filtering, Gateway anti-filtering to scan all the traffic.

By implementing a multi-tiered approach to client-side, server-side and
enterprise, organisations can easily manage their protection technologies against today’s and
tomorrows threats. Phishing is just a part of Hacking culture, So only preventing phishing is not enough way, so implement the secure way to prevent other criminal attack vector. be on safe side.

February 24, 2010 07:39 PM

Ishwor Gurung

Write assembly in Python!, posted Feb. 24, 2010

Multiple things have happened over the last couple of weeks and few months I spent not blogging.

First, I picked this wonderful post by Robert Kern on python mailing list today that made me blog in the first place; Much thanks owes to him for enlightening mere mortals like me. I am still to play around with it but reading the docs is half the battle done. It is all documented at http://www.corepy.org; if you flip over and start reading the "hello world" side of things at http://www.corepy.org/wiki/index.php?title=CorePy_Basics, it looks ridicolously fun and easy again! I think assembly just became fun again :-)

I'll leave it upto you as to basically what you can do them but essentially to do anything substantial you'd have to pump out a lot of asm using CorePy. One could implement some native assembly code in it and use other python libraries to do some really neat stuff. If you only dabble in Assembly like me and wish to not leave the comfortable rear-view seat of Python's high-level world, then CorePy is for you!

Take a look at this snippet:

  import corepy.lib.printer as printer
  import corepy.arch.x86_64.platform as env
  import corepy.arch.x86_64.isa as x86
  from corepy.arch.x86_64.types.registers import *
 
  code = env.InstructionStream()
 
  x86.set_active_code(code)
  x86.mov(code.gp_return, 11)
  x86.add(code.gp_return, 31)
 
  printer.PrintInstructionStream(code, printer.x86_64_Nasm(function_name="foobar"))

The code above prints x86 instructions (intel style- "x86_64_Nasm" plugin) and assigns them to a "foobar" function. See below for output. More documentation on CorePy are available at their website.

BITS 64
SECTION .text
global foobar
foobar:
 
PROLOGUE:
        push rbp
        mov rbp, rsp
        push r15
        push r14
        push r13
        push r12
        push rbx
 
BODY:
        mov rax, 11
        add rax, 31
 
EPILOGUE:
        pop rbx
        pop r12
        pop r13
        pop r14
        pop r15
        leave 
        ret

If you are really into Assembly and Python, I'd recommend you give CorePy a go; do drop a line how it goes. If you're an Assembly/CorePy/Python hacker then please enlighten me :-)

Secondly, I have been working on my Djangle blog engine for the last couple of months on an irregular basis; I'd love to work more on it but due to my day job as a Perl hacker, it's quite hard to find the time commit code. It's also quite a bit of a concern for me as some days I feel utterly tired while the other days I feel exactly the other way around. Anyhow, the things that are on my list to make this a bit more "developer" friendly in near future are-

  1. Pingback and Trackback
  2. Management page
  3. Integrating video, audio, pictures
  4. Media library - Photo, Audio
  5. Social web integration - Facebook, Flickr, Youtube, Twitter, Openid, Wave, Buzz etc..
  6. XML-RPC API for "push" and "pull" (this is a big "maybe" at the moment though)
  7. URL pagination for permalinks (the current URL scheme kind of sucks)

Do drop a line if you feel something must exist in a blog engine; If it's reasonable and challenging enough, I might skip few of the ones above to implement them :-)

Thirdly, I have been reading a lot of books recently that encompass multiple programming languages, theories and whatnot. I buy using http://www.booko.com.au which is by far the best place to find cheaper books in Australia. Theyt essentially aggregate the price of an item across several stores and sorts them in descending order for you by price! The books I am reading simulaneously for essentially reference purpose, educational learning etc. are -

  1. Programming Erlang
  2. Coders at Work
  3. Definitive Guide to Catalyst
  4. Programming Collective Intelligence
  5. Advanced Programming in the UNIX environment
  6. Secure Programming with Static Analysis
  7. The Visual Display of Quantitative Information
  8. Pattern Recognition and Neural Networks

They are all very interesting but it's kind of hard to squeeze them all into a 24-hour day so, I read them at a very gradual pace using some of them as a good reference on a subject matter.


Fourthly, I have been visiting and meeting some of SyPy, GTUGers at Google for various talks and social gatherings. Some of the talks and hackfests I've been to are:

  1. Python game under 5 minutes - Tim Ansell => An amazing Python hacker and my project mentor for a brief period at UniSA
  2. GeoDjango - Peter Marks
  3. Go - Rob Pike
  4. Closure - Daniel Nadasi
  5. Project Bondi - Adrian Dries
  6. Django usergroup meetup - Digital Eskimo
  7. PlanningAlerts.org.au - Matthew Landauer
  8. Creating a CC machine learning dataset - Chris Neugebauer

There were lot of other talks and social "lubrications" I went to that I can't recall. Things of interest though - if you live in Sydney and are into python, linux, opensource software, then do join Sydney Python usergroup, Sydney Linux usergroup, Sydney django usergroup (there are only a table-full people at the moment but given Django's growing popularity, I reckon it will see an increase) and GTUG if you are into Google stuff (I just rocked up for Go! talk by Rob Pike). Go talk was an interesting event but I'd rather stay away from it for the moment. The reason I'd stay away is because firstly, I don't enough time (I have Erlang on my plate!). Secondly, I have too many hobbies (AVR, Software Security, Heavy mathematics yada yada.. on my plate!!). So, sorry Go, you'd have to wait. The language itself is cute though. You can use a C compiler to generate native binaries from Go code (from Ken Thompson and Ian Taylor respectively), do all kinds of funky stuffs with Functional-style programming, do threads and lot more. If you're interested Go is at http://golang.org (http://www.youtube.com/watch?v=rKnDgT73v8s for videos, http://golang.org/doc/ for slides)

Lastly, this blog. My blog runs on my own hand-crafted Python blogging engine still in its infancy and named "Djangle". Named so because it rhymes with Django and Angle - "Angle" because the a blog is an angle of a mind; We project our thoughts into it and make sure it's got an angle to just sufficiently mean the things we want it to mean, to convey something to the inhibitants in our own words and to cover just about enough people's satisfaction like a right-angle ;-)

The source is at http://github.com/ishwor/djangle and if you are good at Python and feel like taking those fingers for a small ride, please by all means join my effort to create a simple, elegant and functional blogging engine using Django; This can be a good experience for us! :-)

February 24, 2010 01:00 PM

February 21, 2010

Surmandal

Many way to securing Linux Box

Some security tips (Linux)--there is more to go but for this time Please bare with it :D

 

  1. Encrypt all the data communication using password/keys/certificates. Use sftp/scp/rsync and sshfs/fuse (http://surmandal.livejournal.com/2244.html) to mount your home directory remotely.
  2. Use of GnuPG, it allows to encrypt and sign the data.
  3. Openvpn is another ssl vpn tools to connect your office/corporate LAN from outer Network.
  4. Avoid using FTP/TELNET/Rlogin like tools, using these tools; anyone can view/capture the packet using sniffer tools.
  5. Do not install any application until and unless it required. To minimize the Vulnerability, list the installed package (dpkg --list Ubuntu/debian), list out the necessary application and remove others. Remove the X, in server you don’t need X window, it will increase the server performance.
  6. Use one machine for one application/service if possible for example install Apache and mysql service in different machine so that if attacker rooted to web server, there will be less chance to tooted mysql server. Virtualization will be another good application to reduce this thread.
  7. Offcourse, update regularly kernel/software, installed patch.
  8.  SElinux ---- see how to guid ;)
  9. Use of Strong Account/password policy, in existing system, use the john the ripper tools to find out the week password and make it strong( using alpha numeric/upper-lowercase/special character).
  10. Disable the root login/find out any user has UID 0, if yes make sure that s/he is allowed by you else remove it.
  11. Use of packet filter/ tcpwrappers, Do not forget to use IDS, there is a software called AIDE, I highly recommend it to use in your system.
  12. Strong physical security, use of Bios/GRUB password, disable the CD/DVD Drive, also USP ports
  13. Try to change the default service port, i.e. open shh server runs in 22 port, change it to 2010 (as your wish)

 

 

February 21, 2010 08:37 PM

February 19, 2010

Jwalanta Shrestha (jwala)

Overriding extension compatibility check for FF3.5+

Disabling extension compatibility check for Firefox was easy. Go to about:config and create a boolean value named extensions.checkCompatibility and set it to false.

Until Firefox 3.5!
(More specifically, products that are based on < Gecko 1.9.2)

Newer Firefox requires you to append version number to the variable. This will ensure the extension override wont work forever as FF is upgraded to next version. For example, in Firefox 3.6, the variable would be extensions.checkCompatibility.3.6

Explained in detail here:
http://kb.mozillazine.org/Extensions.checkCompatibility

by Jwalanta Shrestha (noreply@blogger.com) at February 19, 2010 11:58 AM

February 17, 2010

Jwalanta Shrestha (jwala)

Converting Latex document to HTML / ODT / DOC

I do all my documents in Latex. Actually i usually use emacs org-mode first and later convert it to Latex, but when it comes to using bibtex, it's all latex. It works great and the output dvi/pdf files look so professional. However recently i had to submit the file in .doc format, and i had a real hard time finding good tools to do that.

There are no direct Latex to .doc converters, so the best bet is to go Latex -> HTML -> DOC. There are lots of Latex to HTML converters like latex2html, tth and hevea, but most of them either don't produce good HTML or mess with bibliography references. But after some research i found the best: TeX4ht

TeX4ht is available in ubuntu/debian repo, so to install
sudo apt-get install tex4ht
Conversion is simple:
htlatex document
(please note, there is no .tex suffix)

This will generate document.html, css and bunch of .png files.

Now to convert it to wordprocessor files (odt, doc..),
1. Open the html file with OpenOffice.org
2. File > Save as
3. Choose the format you want to save it in (odt, doc)

If you have images in the document, they will be linked instead of embedded in the document. To fix this: (source)
1. Edit > Links
2. Click "Break Link" for each image link

by Jwalanta Shrestha (noreply@blogger.com) at February 17, 2010 09:18 AM

February 16, 2010

Bibek Paudel

Prasanna Gautam (SR71-Blackbird)

Ruby vs Python Battle to Death

This is a pretty interesting talk by Gary Bernhardt about the good and bad things about Ruby and Python. Here's the blog post Python vs. Ruby: A Battle to The Death from Gary Bernhardt on Vimeo.

February 16, 2010 11:00 AM

February 15, 2010

888

Gmail and OpenID


Q. Can I use Gmail as OpenID ?
A. Yes.

Q. How can I use my gmail ID as OpendID ?
A. Use the url http://www.google.com/accounts/o8/id

by noreply@blogger.com (Techs Palace) at February 15, 2010 03:51 PM

Prasanna Gautam (SR71-Blackbird)

Userscript to remove read news

So, I've been dabbling with Javascript in a very serious way right now. For one, I'm taking the Advanced Web Programming class where we are officially learning the language. I have to admit, I am getting to learn new ways of doing things and realizing what a jarhead way of ...

February 15, 2010 09:00 AM

February 14, 2010

888

Google History


With Web History, you'll be able to:

View and manage your web activity.
You know that great web site you saw online and now can't find? From now on, you can. With Web History, you can view and search across the full text of the pages you've visited, including Google searches, web pages, images, videos and news stories. You can also manage your web activity and remove items from your web history at any time.

Get the search results most relevant to you.
Web History helps deliver more personalized search results based on the things you've searched for on Google and the sites you've visited. You might not notice a big impact on your search results early on, but they should steadily improve over time the more you use Web History.

Follow interesting trends in your web activity.
Which sites do you visit frequently? How many searches did you do between 10 a.m. and 2 p.m.? Web History can tell you about these and other interesting trends in your web activity.

http://google.com/history

by noreply@blogger.com (Techs Palace) at February 14, 2010 05:07 AM

February 06, 2010

888

Upside Down Web Cam Simple Fix


Many laptop put their webcam upside down resulting in flipped images in Ubuntu. There were fixes for some but for some you had to physically remount the camera. The webcam that comes with Lenovo Ideapad Y510 is also mounted upside down. Unluckily there wasn't any simple fix for this. (some people rotated the camera physically).

Fortunately Hans de Goede came with a beautiful solution.

Open Terminal and add libv4l ppa
sudo add-apt-repository ppa:libv4l/ppa
Update your software list
sudo aptitude update
Install libv4l
sudo aptitude install libv4l-0
You have to use the following command to open any application that uses webcam
LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so application_name
If you use 64 bit system, use the following command
LD_PRELOAD=/usr/lib32/libv4l/v4l1compat.so application_name

by noreply@blogger.com (Techs Palace) at February 06, 2010 08:37 PM

Bibek Shrestha

His story

He wants to go away. Among people who he knows and who knows him, life will always be an unjustice. Full of complaints. They pin point your flaws but he already knows them. He asks them Why? They remain silent. He knows the "Why?" is a power yet meaningless questions. Whenever you feel like not making a conversation, just ask "Why?". If only they also knew they could complain less, he thinks.

by bibekshrestha at February 06, 2010 02:58 PM

February 05, 2010

Bibek Shrestha

Using custom php.ini in a cPanel server

Recently in our office at YIPL, we needed to increase the upload_max_filesize and post_max_size of one of our clients. We run on a virtual private server with WHM and cPanel.

The default php runs as a FastCGI with suexec enabled.

Here is how I configured apache to run custom php.ini.

1. Know where your existing php.ini file exists.

Just create a phpinfo.php file in your public_html or www folder. Use the phpinfo() function know the current location of default php.ini.

/home/username/public_html/phpinfo.php

<?php
phpinfo();
?>

Access the file with http://www.sitename.com/phpinfo.php.

2. Copy the file inside your cgi-bin folder

$ cp /usr/local/lib/php.ini /home/username/public_html/cgi-bin

3. Create a custom cgi executable to run php.

$ vim /home/username/public_html/php.cgi

Add following lines

#!/bin/sh
/usr/local/cpanel/cgi-sys/php5 -c /home/username/public_html/cgi-bin/
# Note, the parameter after -c is the location of new php.ini

Allow executable permission to the new php executable

$ chmod +x /home/username/public_html/cgi-bin/php.cgi

4. Modify .htaccess to run php with our new executable by adding the following lines at the top

$ head /home/username/public_html/.htaccess
Action application/x-httpd-php5 /cgi-bin/php.cgi

#.. other commands

5. Make sure new configuration is loaded.

The http://www.sitename.com/phpinfo.php file should now show /home/username/public_html/cgi-bin/php.ini as the loaded setting file.

6. Remove phpinfo.php for security purposes

$ rm /home/username/www/phpinfo.php

References

read more

by bibekshrestha at February 05, 2010 01:33 PM

February 04, 2010

Jwalanta Shrestha (jwala)

mpg123: Lightest mp3 player in Linux

If you are in search of the lightest barebone mp3 player in Linux, nothing can beat mpg123. Unless you want flashy visualizations and playlist management and such, mpg123 can save you a lot of memory and cpu horsepower.

Installation is easy. In Ubuntu,
sudo apt-get install mpg123

Mpg123 comes with loads of options. Check out the man page for details. Here I'm gonna share a few usage tips.

Shuffle-play a directory of mp3s:
mpg123 -CZ /path/to/mp3/folder/*

-Z option is for shuffle, -C is for control. From man page:
-C, --control
Enable terminal control keys. By default use ’s’ to
stop, ’p’ to pause, ’f’ to jump forward to the next
song, ’b’ to jump back to the beginning of the song,
’,’ to rewind, ’.’ to fast forward, and ’q’ to quit.
Type ’h’ for a full list of available controls.

Equalizer:

Don't fall off your chair! Yes, mpg123 also comes with 32-band equalizer. But there's no inbuilt graphical UI for that, you need to create the plain-text file. There's an editor though if you like, but creating one is not hard either. From man page:
-E file, --equalizer
Enables equalization, taken from file. The file needs to
contain 32 lines of data, additional comment lines may be
prefixed with #. Each data line consists of two floating-
point entries, separated by whitespace. They specify the
multipliers for left and right channel of a certain
frequency band, respectively. The first line corresponds
to the lowest, the 32nd to the highest frequency band.
Note that you can control the equalizer interactively
with the generic control interface.

I've made one with party feel: party.txt

Usage:
mpg123 -CZ -E party.txt mp3_file

Songs again and again:

Plus if you kind of person who listens to couple of songs again and again for weeks (instead of shuffled huge playlist), then hi5! :) and here's how to do that with mpg123:
mpg123 -CZ song1.mp3 song2.mp3

by Jwalanta Shrestha (noreply@blogger.com) at February 04, 2010 11:15 AM

February 03, 2010

888

Multiple profile in Google Chrome in Ubuntu


I'm talking on basis of Ubuntu. This may or may not work in other OS.
You can use Google Chrome with multiple profile to:
  • Open different email address at once. For eg: open abc@gmail.com in one window and xyz@gmail.com in another
  • Separate personal stuff and your work stuff
  • Allow your family member to login without you signing out
These are the main reasons I use multiple profile in google-chrome. If you don't want to go through this hassles, you can always open multiple browsers.
For case in point you are browsing facebook.com and your sister wants to open the same site for quick check, you can either open different browser or open the same browser that has different profile. (or open in private mode too)

Both my favorite browsers Chrome and Firefox supports multiple profile. For now I'll write instructions for Chrome:
  1. Right click your panel, select add to panel and select custom application launcher (if you want to add in panel)
    or
    Right click the menu, select edit menus and click new item (if you want to add to menu)
  2. Fill it as:
    • Type: Application
    • Name: Google Chrome Profile A
    • Command: google-chrome --user-data-dir=/home/userName/.config/google-chrome/newProfile (the text in picture isn't correct)
  3. Click close
  4. Thats it folks.

by noreply@blogger.com (Techs Palace) at February 03, 2010 03:06 PM

Jwalanta Shrestha (jwala)

Making DLink DWL-650+ PCMCIA Wireless card work under linux

The DLink DWL-650+ PCMCIA Wireless card doesn't work on recent Linux distros (I tried Ubuntu Hardy to Jaunty). After plugging in, the system hangs with CapsLock flashing.

Turns out the card is handled by acx module and the support is broken for this card. So use ndiswrapper instead.

First blacklist acx module. Open /etc/modprobe.d/blacklist.conf file and add the following line
blacklist acx
Now install ndiswrapper
sudo apt-get install ndiswrapper-common
Now get the Windows driver for the card from here. Extract the file, go to the winxp folder and,
sudo ndiswrapper -i AIRPLUS.INF
The card should work now.

by Jwalanta Shrestha (noreply@blogger.com) at February 03, 2010 08:19 AM

February 01, 2010

Ishwor Gurung

Eclipse, Pydev, Epic, Java, ErlIDE all in one, posted Jan. 23, 2010

Eclipse IDE, Pydev, Epic, Java IDE, ErlIDE is bundled up and available to download (117Mb) from here . Kindly note, that all the packages and the dependencies were strictly downloaded and tested on Ubuntu 9.04 only. The versions includes:

  • Eclipse IDE- Galileo 3.5 SR1
  • Pydev Release: 1.5.4
  • Epic - Testing: 0.6.35
  • ErlIDE - 0.7.3

All software belong to the respective projects. Kindly use it at your own risk. I am providing it merely because of convenience.

[ishwor@muffin:~]$ sha256sum eclipse+java+pydev+epic+erlide.tar.bz2 8249ae3a489f00f2418b8c6d79d936e98d7d4dfc271093bfa52bf7515ea237e8 eclipse+java+pydev+epic+erlide.tar.bz2

Happy hacking! :)

(update: re-posting because of typo in my RSS template. Apologies)

February 01, 2010 12:06 PM

First post!, posted Feb. 27, 2010

New post using Djangle blogging engine :)

February 01, 2010 12:06 PM