Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Thursday, September 27, 2012

Update Dell BIOS from linux

NOTE: messing with your BIOS is obviously dangerous.  Proceed at your OWN RISK!
First, install libsmbios-bin
sudo apt-get install libsmbios-bin
Now, you need to get the proper .hdr file.  It is bundled inside those little executables Dell has on their website.  So, start by downloading the latest .exe file from Dell. These can be extracted either with unzip or wine, as shown from this log file.
After trying unzip, I tried this command, and it worked:
wine O780-A13.exe -writehdrfile -nopause
Creating the file: O780-A13.hdr Now, follow these directions (as su or root):
modprobe dell_rbu
dellBiosUpdate -u -f ./O780-A13.hdr
Now just reboot, and wuala, an updated BIOS.

Monday, August 8, 2011

*Listen* to Youtube on linux (legally)

Per the terms of service, you are not supposed to download YouTube videos. However, it does NOT say that you cannot view them in something other than a web browser.  The main problem with youtube is how much garbage/dodginess there is.  Also, most of the time I just want to listen to the music anyway.... what to do?

The answer: use youtube-dl to provide the correct download link, then stream to mplayer and null the video.

Steps:
  1. Download youtube-dl and put somewhere in your path (such as ~/bin/) and make executable.  If your player breaks, just download the latest version (up within 24 hrs of a youtube site modification) and it should work again.   They have a youtube-dl .deb package in the ubuntu repos, but it is obsoleted pretty fast (for instance 10.04 doesn't work).
  2. make sure mplayer and python are installed: (sudo apt-get install mplayer python)
  3. Use this command:
mplayer -vo null -cookies -cookies-file /tmp/cookie.txt $(youtube-dl -g -f 34 --cookies /tmp/cookie.txt "http://www.youtube.com/watch?v=pGruu89cCw8")


Of course, you will change the video link to be the one you like.  Here is some explanation of what is going on:
  • Youtube requires cookies to be enabled.  We get the video link via youtube-dl and put it into the cookie file.  mplayer is using cookies and reads the url to play from the cookie file.
  • The -g means get the url, and -f changes which file format you are getting the link to (look up youtube codes... current options are 5, 34, 35, 18, 22, 37, 38, 43, 44, 45, 17).  34 is the lowest resolution flv format at 128 kbits/s sound (and I think is standard "360").  18 would give you 96 kbits/s sound.   
  • -vo null means no video output.  Use -fs instead if you want full screen, or nothing for that option if you want regular.
There you have it.  Robust, legal, streaming audio player for youtube.

This also seems to work on short playlists, but not always:

mplayer -vo null -cookies -cookies-file /tmp/cookie.txt $(youtube-dl -g -f 34 --cookies /tmp/cookie.txt "http://www.youtube.com/view_play_list?p=460F66B8E8E56FB6")


Navigate through the tracks with ">" and "<".



Tuesday, April 28, 2009

Keyboard Shortcuts in Gnome, KDE, wmii, or whatever

Ubuntu Jaunty Jackelope put keyboard shortcuts in their proper place (disabling those in metacity and putting them in 'Keyboard Shortcuts'). However, when opening a gnome terminal from this shortcut, you have to explicitly tell it to start in your home directory or it will start in '/'

System->Preferences->KeyboardShortcuts  then [+Add]

gnome-terminal --geometry 80x52 --working-directory $HOME

I like to set up my keyboard shortcuts with a script since I like to use them on whatever computer I'm on. I did this before with gconftool2 and that worked fine, but now a person has to set them in a different location in a different way... which got me thinking that it would be nice to set keyboard shortcuts in a cross-desktop (KDE, Gnome, wmii, whatever) kind of way.

Solution: xbindkeys

sudo apt-get install xbindkeys

Make a file called '.xbindkeysrc' in your home directory with something like this in it:

"gvim"
control+alt + g
"nautilus"
control+alt + n
"firefox -new-window http://gmail.com"
control+alt + e
"nautilus"
control+alt + h
"firefox"
control+alt + f
"gnome-terminal --geometry 80x40"
control+alt + t
"rhythmbox"
control+alt + m

now you can turn on the shortcuts with the simple command 'xbindkeys', but we'd really like for them to be turned on once when we login. Turns out cross-desktop startup is not very uniform but I think the proper way to do this (cross-desktop) is to do this:

Make sure you have a directory called '.config/autostart'. Then add a file to it called 'xbindkeys.desktop' with content along these lines:

[Desktop Entry]
Type=Application
Name=XBindKeys
Exec=xbindkeys
Icon=system-run
Comment=
Name[en_US]=XBindKeys
Comment[en_US]=
X-GNOME-Autostart-enabled=true

This is what happens in Gnome when you add an entry in System->Preferences->StartupApplications.