[Update] Download youtube videos in linux
I had posted long back about a bash wrapper over youtube-dl to fetch youtube videos using your own download manager. The youtube-dl script had changed long since then. And good news is now we don’t need to change the script in any way to get the download url. So here we go!
Grab the latest youtube-dl from here
Minor update to the linux youtube-dl script:
#!/bin/bash
if [ $# -ne 2 ]
then
echo “Usage : $0 ”
echo “e.g : $0 http://www.youtube.com/watch?v=D1R-jKKp3NA steve_jobs”
else
outputfile=”.avi”
todnload=$(youtube-dl -g $1) # youtube-dl is in path, right?
echo “Got the file..”$todnload
axel -n 100 $todnload -o $2″.flv” # wget -c $todnload -O $2″.flv” .if you don’t use axel
echo “Download Completed…”
ffmpeg -i $2″.flv” $2$outputfile # get the avi file
fi
Enjoy
Thanks Jay for pointing this out!
How to choose a web host
Lemme shout it aloud: I am a big fan of free webhosts
Until recently, one of my friends made me realize(brainwashed!) that probably I had had my part of the freebies
And its been long since I last did something php-ish, so the thought of getting hands dirty with web programming made me take this bad decision of getting a host.
And dude, choosing the right host _is_ much tougher than expected. It ate up some 10s of my sleep-hours and a few man-weekends
Finally, yesterday I gave up(damn it! set IDontCare=true) on my FindBestHost greedy approach and purchased a hosting package.
A few suggestions for those looking out for webhosts:
- Apply filters
Define your purpose. Why you need a web host? What kind of websites you plan to host? Any special requirements? How much resources(space/bandwidth) do you think you’ll spend?
As an example, here are my answers: I need a webhost to host a blog(pleaseeeee not one more!). Mostly the website will be personal and will host my dev work, some projects. Since I am a self-proclaimed web hobbyist, I would need flexibility in terms of scripts (RoR?). At max, I will put in 5-10 domains in the web space. Considering a GB per site, will take up 5GB and assuming a moderate crowd will use my web resources, lets allow 40GB per domain per month, that would make bandwidth around 200GB per month. - The search begins!
Use your favorite search engine. Ask around. SetGTalkStatus/Twitter/Spam/Scrap/Write-on-wall your contacts. If they can refer, your hard job is done. Don’t waste time on more search. Jump to the next step.
In case you’re shy to ask people, you can look in some good webhosting forums (e.g: WebHostingTalk). They’re good. Lots of webhost guys roam around there. I got around 14k results for a simple search query “recommend host”
I think first 3-4 pages should suffice. This is a good starting place as well.
- Test the host!
At this time, we should have a shortlist of 4-5 hosts. Now for each host try this:- Go to Webhosting.info. Search for the webhost. Have a good look at the number of domains coming into the host and going out each week. You can country wise breakup of top hosts. For me the most important criteria was domain in/out analysis and total domains hosted.
- Do a “You suck” test. Query your favorite seach engine for negative reviews of the host. E.g: Go to your favorite search engine. Query for “[webhost] sucks”. Safely ignore the [Web Host Name]reviews.com(e.g: [TheBigCheapAndBestWebHost]Reviews.com) websites. A good choice would be query in Blog Search.
- Consider having a chat with the sales/support people at the webhosting live chat. Sometimes the time they make you wait will immediately give you a feel of their customer service
- Beware of these!
- The “foobar” offers. Before you sell out cash on *any* offer that gives you substantial discounts, make sure you’re aware of their normal(non-foobar) pricing. Unless you plan to change host every billing cycle, you will be charged against the normal pricing. E.g: A webhost offers 4.95USD as foobar price and normal pricing is 7.95USD.
And I never understood the rationale behind the *.95USD pricing rule. - Overselling. I was really astounded at the number of companies offering unlimited resources. So I went around bugging their sales/support guys on this. They say you can’t store personal files(Does it translate to “all your files must be web accessible”?). I doubt if they have shared hosting customers who distributes legal 1gig files! I wish I could copy/paste the chats I had with these guys
Clearly these people are overselling. They’ll put in your site in some server with probably a few hundred more poor domains. IMO unlimited bandwith can make sense for people who publish streaming content. But does the resource usage policy of these shared hosts allow you to stream enough?
I would suggest to take a limited resource plan. I agree we all love greedy algos, but lets truly have an estimate of the resource usage before getting lured away on such offers.
- The “foobar” offers. Before you sell out cash on *any* offer that gives you substantial discounts, make sure you’re aware of their normal(non-foobar) pricing. Unless you plan to change host every billing cycle, you will be charged against the normal pricing. E.g: A webhost offers 4.95USD as foobar price and normal pricing is 7.95USD.
Hope this might save a few minutes while deciding for a webhost. Good luck!
Sistine: A sify broadband client
Sify provides a connection client(they call it BBClient) for linux. If you use bbclient on *nix, these would have hit you:
- Sifyconnect is a pre-compiled (linked to old openssl libs) binary. I had to literally do some ‘n’ softlinks to get it start.
- As soon as I login, I am greeted with Sify homepage. That to with firefox running from root
- They overwrite my custom resolv.conf with the sify nameservers.
- The UI is a gtk interface which hangs on. I think it needs a systray to hide. Unfortunately my wm doesn’t provide a systray (though I can use stalonetray, but using that for a single app..)
After living through these for nearly three months, yesterday the level of irritation overtook my laziness. I had to disconnect few times and everytime the client would fork a firefox. The search for alternate client began. I stumbled across a nice hack by Liet-Kynes. The hack literally dissects the sify connection mechanism
Stepped through the script and modified a few bits to get the script working in my machine. And now its release time!
Download: Sistine-20081002.tar.bz2
Usage: Login: sistine.py in | Logout: sistine.py out || Please read the README bundled in the archive.
ChangeLog:
- Simple command line args. (in: login and out:logout)
- Added Logout support to the script
- Minor modification to connection string
- A small bug: If your password contains special characters then the script might not connect. I will look into this for next update. Please patch it if you’re a python guy.
Disclaimer: Your box might burst/fly/crawl on running the script. Don’t blame me for that. The script works normally for me btw.
License: Public domain. Bend it as you like.
I’ve tested the script in linux. It should work in windows as well if you’ve python installed.
The original code by Liet-Kyne is sistine-20070828.tar.gz. Kudos to Liet-Kyne, buddy you’re a true hacker
E17 and fake transparency
E17 stores the background images in edje file format. Edje (*.edj) is a binary file format which compresses the images quite a bit and has many additional features (animations, layers etc.). Creating an animated background for e17 is quite easy (check here). There is already the wallpaper module in e17 which can set the current wallpaper to any image.
What if we want to write a cron job to switch the wallpapers (think slideshow module?). Adding a bit more complexity to it : e17 doesn’t like fake transparency and may not change its mind in near future (source) and our terminals(mrxvt?)/system tray(stalonetray) need fake transparency. There’s a nifty hack called Esetroot which sets fake transparency but doesn’t change the e17 background.
Even there’s a way to achieve both : Install the e_utils package and photo module. Right click on any image in photo module and you can set it as your background.Actually the photo module calls e17setroot program in e_utils and sets the background and then calls Esetroot to set fake transparency. If you already have e_utils up and running, you don’t need to read further
A script to emulate e17setroot
- Get the files : e17setroot and edc_skeleton
- Put e17setroot in $PATH (e.g: in ~/bin) and change the line #31 to the location of edc_skeleton file
- To set your wallpaper use
e17setroot null /path/to/image/file
How this works ?
The main script e17setroot uses edje_cc to create the edj file. Edje (edje_cc) in fact needs an .edc file which contains few parameters to create the edj file. Our script takes the skeleton of an .edc and replaces the image name. And the resulting edj is placed in the ~/.e/e/backgrounds directory.
/me leaves the use of e17setroot to /reader’s creativity
Real transparency in urxvt
Add the following lines to the ~/.Xdefaults to get a transparent urxvt terminal:
urxvt*depth: 32
urxvt*background: rgba:0000/0000/0000/dddd
The depth option tells urxvt to use 32 bits to define a color. Generally a color is represented as 24 bits (8 bits each for Red. Blue and Green). We add 8 more bits to store the Alpha(transparency) information. More info
Then we set the background option to denote the 4 different color information : Red/Blue/Green/Alpha.
To change the shading change the Alpha value in background option. 0000 = full transparent and ffff = no transparency.
For e17 users: Use the bling module for composite effects.
Testing Vimpress
Vimpress is a script for VIM which allows posting to wordpress blogs from
the best $EDITOR
For more information, visit the project page :
http://www.friggeri.net/projets/vimpress
Also checkout :
- http://linuxtidbits.wordpress.com/2008/02/29/publishing-a-blog-in-vim-with-vimpress/
Test stuff here
underlinebolditalic
Ciao
Play chess with god
That was the topic of my talk on “How computers play chess”. Here’s the link to the presentation at scribd.
Some of the useful links :
- Chess programming series at GameDev.net
- Chess programming tutorials by Bruce Moreland
- Alpha-beta Algorithm by Yosen Lin
- Introduction to Game Trees by Hamed Ahmadi Nejad
- How your chess program defeats you by Kurt Godden : part1 | part2
BTW this is my first post this year! So a “Happy New Year” to all officially
I hope its not too late
Well during these 3 months, I coded two(three?) websites, modified an Online Judge server for our college’s online programming contest, brushed up gimp, played a lot with php and started using “Ratpoison and GNU screen” along with my e17 desktop environment.
Tags: chesslife php











3 should-use vim plugins
with 5 comments
The first two are very useful, if you kill bugs for a living (read debugging freak).
‘NERDs use real editors (VIM
This is your friend for browsing those 1000x lines of legacy code. All it does is: creates a split window and shows the macros, functions, variables etc.. You can C-w (ctrl+w) to the split window and start jumping through the code. Ofcourse, I agree with the die hard ctags fans. CTags is the ultimate thingy! I prefer not using my best weapon(ctags -R *.cs) against a single progam.cs which has damn 3000 lines of code (its reality! spare me, I din’t write that program :)). So here’s how to bring down the taglist to single key:
! put this in .vimrc/_vimrc! press \tt to toggle taglist on/off in normal mode
nmap <Leader>tt :TlistToggle<cr>
This will add “time” dimension to your source code. First time you create the file, add these:
Created: TIMESTAMPLast Modified: TIMESTAMP
Rest assured for the life of that file. Every time you save the file, Last Modified will get updated. For those lazy guys, this is a tool to measure your level of procrastination.
What would be your “three” should-use vim plugins?
Written by arun
September 10, 2008 at 6:35 am
Posted in Programming
Tagged with code, comment, productivity, tags, vim