Sunday, June 26, 2011

sleep mode and hdparam


Is my drive sleeping?

user@host:~$ sudo hdparm -C /dev/sdb

/dev/sdb:
drive state is: standby

Set my drive to sleep

user@host:~$ sudo hdparm -Y /dev/sdb

/dev/sdb:
issuing sleep command


Thursday, July 15, 2010

finding files

Last couple of months I've wanted my output format to look like this from find:
Mon Feb 15 12:49:18 2010, 50356KB, ./files.txt

This was the printf format I've used.
find . -name tmp* -type f -printf "%t, %kKB, %h/%f\n"

Sunday, July 11, 2010

Crontab summary

A good crontab summay.


I was looking to redirect stderr to stdout and append to a file -- example

*/10 * * * * /bin/execute/this/script.sh 2>&1 >> /var/log/script_output.log

Monday, January 25, 2010

MySQL MyIASM files what are they for MYI,MYD,frm

One would hope to never need to know this, but an unfortunate soul who is trying to recover MySQL MyISAM tables may need this.


http://forge.mysql.com/wiki/MySQL_Internals_MyISAM

A quote from the above:
'MySQL creates files named Table1.MYD ("MySQL Data"), Table1.MYI ("MySQL Index"), and Table1.frm ("Format")'

Thursday, December 24, 2009

Mythtv File Parsing for Metadata

From
http://www.mythtv.org/wiki/MythVideo_File_Parsing

Filenames

  • A Movie Title.mpg
  • Title s01e01 Subtitle.mpg
  • Title 1x01 Subtitle.mpg
  • Title Season 1 Episode 1 Subtitle.mpg

Filename/Path combinations

  • Title/Season 1/01 Subtitle.mpg
  • Title/Season 1/s01e01 Subtitle.mpg
  • Title/Season 1/1x01 Subtitle.mpg
  • Title/Season 1/Title s01e01 Subtitle.mpg
  • Title/Season 1/Title 1x01 Subtitle.mpg
  • Title/Season 1/Episode 1 Subtitle.mpg
  • Title/Season 1/Season 1 Episode 1 Subtitle.mpg
  • Title Season 1/01 Subtitle.mpg
  • Title Season 1/s01e01 Subtitle.mpg
  • Title Season 1/1x01 Subtitle.mpg
  • Title Season 1/Title s01e01 Subtitle.mpg
  • Title Season 1/Title 1x01 Subtitle.mpg
  • Title Season 1/Episode 1 Subtitle.mpg
  • Title Season 1/Season 1 Episode 1 Subtitle.mpg

Sunday, December 13, 2009

Ubuntu squeezeserver audio transcoding support

To add a few more transcoding/decoding dependencies for your ubuntu squeezeserver install:
sudo apt-get install faad flac lame mplayer ffmpeg alac-decoder sox wavpack shntool

Tuesday, December 08, 2009

Linux process listening on a port

Command-line:

sudo netstat --tcp --udp --listening --program



http://www.go2linux.org/which_service_or_program_is_listening_on_port

Sorting DU results

A quick 'one-liner' to sort the results of a du by size.

from: http://ubuntuforums.org/showthread.php?t=885344


sudo du -hx --max-depth=1 / | perl -e '%byte_order = ( G => 0, M => 1, K => 2 ); print map { $_->[0] } sort { $byte_order{$a->[1]} <=> $byte_order{$b->[1]} || $b->[2] <=> $a->[2] } map { [ $_, /([MGK])/, /(\d+)/ ] } <>'

Thursday, November 26, 2009

Ubuntu and temp sensors applet in the panel

The following is the link to how to configure this for Ubuntu:

http://www.techthrob.com/2009/03/02/enabling-hardware-sensors-in-linux/

Wednesday, November 11, 2009

Turn your mp3 into an iphone Ringtone

This little nugget worked for me to turn one of my existing mp3s into an iphone ringtone:

http://www.ehow.com/how_2160460_custom-iphone-ringtones-free.html


All that and it was free and just a little work using iTunes.

Friday, October 23, 2009

Network UPS Tools (NUT) in Ubuntu Server

I used this Ubuntu NUT article as a basis for installing NUT on Ubuntu Server 9.04.

I did install it command-line ( apt-get install nut) and found you need to 'reboot' to have the new udev rule file run against the USB UPS.

Wednesday, October 07, 2009

Linux Distro Review

A quick, easy to read review of a number of Linux popular distributions.

http://www.osnews.com/story/22305/Linux_Distros_that_Don_t_Suck

Saturday, March 28, 2009

MythTV

The following is the documentation I used to configure MythTV on the following system:

Motherboard: Asus M3N78-EM http://usa.asus.com/products.aspx?l1=3&l2=149&l3=676&l4=0&model=2260&modelmenu=1
CPU: 65w AMD Athlon 64 X2 Dual Core Processor 5200+ Brisbane 2.7GHz
Heatsink/Fan: Thermaltake TR2-R1
RAM: 4GB RAM DDR2 800MHz Patriot
Video Card: On board video Geforce 8300
Sound Card: On board motherboard Realtek ALC1200 8 -Channel HD audio
HD: 2 x SATA 1TB WD Caviar Green WD10EADS-00L
Optical: Lite-On iHAS120 DVD-RAM
Remote: Harmony One Advanced Universal Remote
Tuner: HDHomeRun Home Networked Digital TV Tuner http://www.silicondust.com/
Receiver: ONKYO TX-DS696
Case: Antec Fusion Remote Black http://www.antec.com/Believe_it/product.php?id=NzE4
TV: Panasonic 42" plasma TH-42PX60U
Country: USA
TV provider: Comcast

This was done on the Mythbuntu 8.10 release http://www.mythbuntu.org/ by simply sticking the 64 Bit (x86_64) Direct Desktop Download CD in the drive and walking through the installation wizard. It was later upgraded to the Mythbuntu 9.04.


Configuring the HD Homrun Tuner:
http://www.mythtv.org/wiki/Silicondust_HDHomeRun
Notes:
* (time consuming) Channel mapping in Seattle required watching all the TV station, then hitting the 'E' key to type in the station information (Callsign and number) as per schedulesdirect.org. Plus enabling that channel in my lineup in schedulesdirect.org.
* Ensure that the network is up before mythtv backend (otherwise the tuner is marked as down)
http://ubuntuforums.org/showthread.php?t=1018339



LCD and Remote:
The new Soundgraph LCD/IR (Antec Fusion usb-id 15c2:0038 with RM200 remote) required the most custom work all phenomenally well documented on this thread
http://ubuntuforums.org/showthread.php?t=1103474

My 19 month son was helping and together we found we could move the front-end screen (by accident pressing the ctrl-[mouse right button[-drag). To restore reset here: http://www.mythtv.org/wiki/Screen_size_setting_wizard

SPDIF(PCM/etc) Sound not working out of the box: For the builtin sound processor on the Asus M3N78-EM(Realtek ALC1200 8-Channel High Definition Audio Codec)
Requires adding the following line to /etc/modprobe.d/alsa-base.conf:
options snd-hda-intel model=6stack-dig

Secondly it required starting the alsamixer, scrolling to the right and un-muting the digital out (IEC958, IEC958 D, IEC958 1)

Thursday, November 27, 2008

Webpage HTTP performance

Yahoo developers have encapsulated much of their experience in optimizing web sites and serving web pages in a Firefox add-in. It is called YSlow, I've been having decent success in analyzing pages using it as of late. It is simple and effective, a great little tool. Not everything is easily achievable and depending on the content you are delivering it might not be reasonable. In the end, I've been able to use it and spend a short amount of time to identify a number of changes needed for more rapid delivery of HTTP content.

Download it, install it, try it ...

YSlow


Keywords: website performance, analyzing website performance, analyzing http performance, http performance, speed up web page delivery

Sunday, February 03, 2008

Gentoo Portage and downgrading to older packages

All in the day of the life of an open source system.

Often I find myself using the time machine to discover whether some new install is the problem or something it depends isn't responding as expected.

So you want something older than curl 7.16 out of the portage tree? Use the less than (<) symbol:

emerge -av "<net-misc/curl-7.16.0"

Monday, December 24, 2007

HOWTO set up NUT 2.2.0 on Gentoo Linux for Tripp Lite OMNI1000LCD USB UPS

Last December after a significantly power outage, I purchased a Tripp Lite OMNI1000LCD USB UPS from Costco. I spent awhile integrating it with my Gentoo distro running on my home server. I found that Network-UPS Tools (NUT for short) was the best way to go. I would recommend them and their mailing list if you are interested in getting anything running -- I've been lurking on their mailing-list for 12 months now and it is one of the most helpful lists I've seen in my days.

Back in December of 2006, I had no choice but to get a development tree and compile it and integrate that with Portage (see old HOWTO link ). Today NUT version 2.2.0 is in the tree but all architectures are marked as in 'testing'. That is the tilde in front of them : ~alpha ~amd64 ~ppc ~sparc ~x86 ~x86-fbsd when you look at portage nut package . unmasking this package will be much easier than my last experience of integrating my own build in portage (overlaying).

I've been running on this 2.2.0 package for a couple months and I declare it seems good to me.

If you want to unmask it and test it yourself that is simple:

(1) add the following line to the file /etc/portage/package.keywords
=sys-power/nut-2.2.0 ~x86

This will allow you to install this package.

(2) emerge nut with the hal flag
USE="hal" emerge nut

(3) Configure NUT

- the OMNI1000LCD is working fine with the new usbhid-ups driver

Now that we've made this build, you can follow the steps at the wiki:
Gentoo HOWTO NUT (Network UPS Tools)

You'll get to start after the Install Software section. Yes, you'll need the usbhid-ups driver. I am pasting my last instructions with the appropriate substitutions for the OMNI1000LCD for NUT 2.2.0.

I added the bit about adding a MONITOR line to uspmon.conf. This is necessary for upsmon to work

Configuring

Go to /etc/nut . Open ups.conf. Add to this file every UPS you want to monitor. Mine looks like this:

# [powerware]
# driver = bcmxcp
# port = /dev/ttyS0
# desc = "Server, adsl, 3com"


Change the values to something that fit's your configuration better and save. If you have a USB connection to your UPS, your entry might look like

[OMNI1000LCD]
driver = usbhid-ups
port = auto
desc = "Tripp Lite OMNI1000LCD USB"

Open upsd.conf. This file contains access-policy to the UPS's you have.

To only allow the same computer to connect to them, the file should look like this:

ACL all 0.0.0.0/0
ACL localhost 127.0.0.1

ACCEPT localhost
REJECT all


The ACL-lines are used to add hosts. The syntax is ACL name IP. If the name is placed after ACCEPT connections from there are accepted, if it's placed under REJECT, connections are rejected. This sort of reminds me of a hosts.allow file?

Next open upsd.users. This file contains accounts for users who can make modifications. The following line grants access to the user server to everything. This isn't integrated with particular logins from my observation. So you can make-up a new user/pass and run with that. The only place one needs to remember this if you are setting properties through NUT on the UPS.


[server]
password = changeme
allowfrom = localhost
actions = SET
instcmds = ALL
upsmon master


Next take a look at upsmon.conf. This is the UPS Monitor configuration. A scan through this file is going to answer more questions than me writing about it. It is pretty simple, but the below three changes are all I needed to make.

1. in Gentoo, the nut package uses the 'nut' user, so ensure this is in there.
RUN_AS_USER nut
2. The UPS to monitor
MONITOR OMNI1000LCD@localhost 1 server changeme master
3. for those of us with a measly single UPS for our home network you'll need this line:
MINSUPPLIES 1



Next if you want look at upssched.conf too, it may be interesting if you want to schedule events. This will be useful if you want to automate something like "30 seconds after the power is out, send an email via SMTP." I currently am not interested in this

Finishing

Now, start the upsd and upsmon service:

/etc/init.d/upsd start
/etc/init.d/upsmon start

This should identify if there is some still wrong.
If nothing is wrong add them to the default runlevel

rc-update add upsd default
rc-update add upsmon default

If you didn't get any error when you started the services you seemed to configure it right. Else, have a look at the error output and think what might be wrong. One error I got was the permissions of the serialport, which is easy fixed with adding nut to the tty-group.

Testing

You'll be using tools upsc and upscmd

Test upsc and see if your UPS replies:

upsc yourupsname@yourupshost ups.status
specifically from above conf: upsc OMNI1000LCD@localhost ups.status

If you get "OL" (On Line) everything is working good (if it is on the line and not battery).

To see every command your UPS supports, type

upscmd -l OMNI1000LCD@localhost

A full status looks like the below.

#upsc OMNI1000LCD@localhost
battery.charge: 100
battery.type: PbAc
battery.voltage: 13.4
battery.voltage.nominal: 12.0
driver.name: usbhid-ups
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.version: 2.2.0
driver.version.data: TrippLite HID 0.1 (experimental)
driver.version.internal: 0.30
input.frequency: 59.8
input.voltage: 117.2
input.voltage.nominal: 120
output.frequency.nominal: 60
output.voltage.nominal: 120
ups.beeper.status: disabled
ups.delay.reboot: 65535
ups.delay.shutdown: 65535
ups.mfr: Tripp Lite
ups.model: TRIPP LITE UPS
ups.power.nominal: 1000
ups.productid: 2005
ups.serial: 692195 B
ups.status: OL CHRG
ups.test.result: 0
ups.vendorid: 09ae

If you've typed that command and gotten a similar response you are on the winning side of this conf.

(4) UPSMON conf
At this point you have the default configuration for the monitoring. If you want to do something aside from a straight shutdown on the battery level reaching a critical level I highly recommend reading up here: Network UPS

Keywords: Tripp Lite, USB UPS, Tripp Lite Gentoo, Tripp Lite OMNI1000LCD, USB HID UPS Linux, Gentoo HID UPS, gentoo NUT 2.2.0 portage overlay, Gentoo UPS NUT, Tripp Lite Linux, Tripp Lite OMNI1000LCD Gentoo, Tripp Lite OMNI1000LCD Linux, Tripp Lite OMNI1000LCD UPS.

Monday, October 15, 2007

How to add a DiggIt, Del.icio.us, Reddit, and more links/button to blogger

Several generations of the internet before today, one manually had to add each link to their blog template. In fact I posted about how to do this sometime a year ago. Time has passed and things have improved.

Yesterday I discovered www.addthis.com, a site that simplifies the process. They manage the details of the links, buttons, and adds the very latest social bookmarking sites. You the blogger can get back to posting, and not waste your day tweaking your templates (unless you like that sort of thing).

Read up on AddThis by going to their site: link

Keywords: add social bookmarking links to your blogger blog, to any of Favorites, Google Bookmarks, Del.icio.us,Digg, Facebook, Furl, StumbleUpon, Yahoo MyWeb, Newsvine, Reddit, Technorati, Live Bookmarks, Yahoo Bookmarks, Twitter, Ask, myAOL, Slashdot, Fark, Simpy, Propeller, RawSugar, Blogmarks, Spurl, LinkaGoGo, Mister Wong, Wink, Backflip, Magnolia, Diigo, Blue Dot, Segnalo, Netvouz, Tailrank, BlinkList, DropJack, Feed Me, Link. Add button to Favorites, Google Bookmarks, Del.icio.us,Digg, Facebook, Furl, StumbleUpon, Yahoo MyWeb, Newsvine, Reddit, Technorati, Live Bookmarks, Yahoo Bookmarks, Twitter, Ask, myAOL, Slashdot, Fark, Simpy, Propeller, RawSugar, Blogmarks, Spurl, LinkaGoGo, Mister Wong, Wink, Backflip, Magnolia, Diigo, Blue Dot, Segnalo, Netvouz, Tailrank, BlinkList, DropJack, Feed Me, Link, Blogger Templates.

Sunday, October 14, 2007

open your files from a find command in emacs/vi or your favorite editor

For those shell experts this is obvious:

emacs `find . -name *.java`
vi `find . -name *.cpp`
etc...


Notice the back-quote which is one of the forms of command substitution.

More about Command Substitution here



keywords: open all files from find command, using find with emacs, using find with vi, find, bash, shell, Command Substitution, open multiple files with emacs, vi.

Saturday, September 29, 2007

LiveJournal to Blogger or Blogger to LiveJournal or to/from Wordpress blog migration tool (Blog2Blog)

Last year I built a little tool that migrated blogs from LiveJournal to Blogger. It was aptly named lj2blogger. Today is the release of version 2.5

I've recently extended it to be able to move blogs from LiveJournal, Blogger, WordPress and publish to LiveJournal, Blogger, Windows Live Spaces, WordPress. This means you can move your blog to a new blog name or clone it.

Time to rename the tool, subsequently, it is now called Blog2Blog. Possibly further blogging systems will be integrated in later versions.

This is now a .NET 2.0 Application.

Download Blog2Blog (2.5.0.0 updated March 9, 2009)

ATTENTION: Noted added Oct, 9, 2008
Users with trouble (0 entries downloaded/exceptions/etc) downloading blogspot.com blogs:

We've identified a bug in the latest google feeds and client libraries. (http://groups.google.com/group/bloggerDev/browse_thread/thread/6fa01659eb21b0d for deep details)

Basically as a work-around, you need to put the blogger.com feed SOURCE-API-URL. To find this you will need to view the html source of your blog and look for the string that will contain "service.post" it will contain a URL like:
"http://www.blogger.com/feeds/*blog_id_number_here*/posts/default"

That is the URL you'll need for the SOURCE-API-URL or DEST-API-URL



Recently added:
Version 2.5.0.0
* Integrated the latest GData .NET framework

Version 2.4.0.2
* Fixed regression in saving journals to disk (empty titles would crash application).Version

Version 2.3.0.1
* Fixed Blogger fetching of large journals 500 entries or greater
* Added Blogger (only) Label fetching and publishing

Version 2.2.1.0
* Publishing to Microsoft's live spaces.
* Fetching from and publishing to WordPress.
* Delete All for Wordpress, LiveJournal, Blogger.
* Subject Title fix for Livejournal
* More description in LiveJournal errors.


You liked this application and you'd like to support its author? Feel free to donate:







There is a Blog2Blog Manual included, but the interface is relatively simple. If you are having a problem, please scan through the comments below; many users have discovered the same things and the solutions. If you don't see your problem, please post a comment and send an email to "blog2blog.support (at) gmail.com".


Blog2Blog Manual


Introduction

This tool migrates a blog from online line Blog systems. It uses the public API of LiveJournal, Blogger, WordPress, and Spaces to extract data and create equivalent entries in a different account.

Features
- Download Journal Entries from LiveJournal, Blogger, or Wordpress
- A simple read-only viewer of downloaded entries
- Publish Journal Entries to multiple online blogs
* upload private entries (it will make them public)
* parse entries and wrap http:// entries with HTML to make them active links
- Delete ALL entries for your destination journal (Blogger, WordPress, LiveJournal supported).

Usage

The designed usage pattern is below.

Download from source Journal
First, Select a source
1. Enter username (e.g. user1).
2. Enter password (e.g. pass1).
3. Enter source-url (the URL of the blog you wish to download): http://user1.livejournal.com.
4. (optional) if necessary modify the source-api-url of your journal. This is auto-populated with a typical value.
5. Press Fetch Button.

View Entries (optional)
6. Press View Entries Button.
7. Use the Entry Number Dialog to change the entry being viewed.
8. When complete Press the upper right close window (the X).

Save Entries (optional)
1. Press Save Entries
2. Choose the filename, it is an XML file with the extension (*.B2B)
Note: once saved you can load these Entries without downloading from LiveJournal (use the Load Entries button)

Publish to Destination
Next, Select a Destination
9. Enter username (e.g. user1).
10. Enter password (e.g. pass1).
11. Enter dest-url (the URL of the blog you wish to upload): http://user1.blogspot.com.
12. (optional) if necessary modify the dest api-url of your journal. This is auto-populated with a typical value. (if you have a non-upgraded blogger blog take note; for non-upgraded blogs you will need to update the dest-api-url! To find the URL you will have to look at the page source of your journal. See below for more information)
13. (optional) select options you please; publish private entries and/or wrap http:// with html tags and/or Publish Back Dated posts.
14. Press Publish Button.
15. Select the Entries you will to publish (defaults to all entries).

Further instructions (non-upgraded Blogger blogs circa late 2006):
For non-upgraded blogs you will need to find your feed URI.
- To do this you will have to use your favorite browser and type in the URL of you blog (e.g. http://user1.blogspot.com)
- Using your browser you will need to 'View Source'. This differs slightly between browsers.
- In the source look for link rel="service.post" type="application/atom+xml" title="User1 (Atom 1.0)"
- The api-url is the http:// location in the href

Additionally it is not possible to post to an old journal with a new 'google' integrated account (for those of you that have only partially upgraded all your journals). Additionally the publish dates of your livejournal won't be regarded. This is part of the API limitation.


Known issues

· The Application is not multithreaded – The UI refreshes slowly while connected to LiveJournal/Blogger.
· Does not import/export comments
· found 01/02/2007 - defaults for api-url only work with upgraded blogs.
· There are occasional connection problems with the XMLRPC interface to livejournal, but immediately retrying Fetch from Livejournal seems to connect successfully. Just try a couple of times. No harm should be done.


Keywords: Blog migration tool, LiveJournal to Blogger migration, LiveJournal to Blogger conversion, transfer blog to Blogger, Import blogs from LiveJournal into Blogger, lj2blogger, livejournal2blogger, migrate livejournal blogger, Blogger to LiveJournal migration, Blogger to LiveJournal conversion, transfer blog to Livejournal, Import blogs from Blogger into livejournal, blog2blog, migrate blogger livejournal blogger, migrate blog to Microsoft spaces, live spaces, migrate blogger to wordpress, migrate blog wordpress to blogger, migrate blog LiveJournal to Wordpress, migrate blog Wordpress to livejournal, import blog into Wordpress, LiveJournal, Bloggger, Windows Spaces.

Saturday, August 25, 2007

HOWTO tether your Blackberry Pearl (8100) to linux (AT&T or T-Mobile)

Since many of you have likely hit this blog while looking HOWTO tether a blackberry on Linux, it would be kind of me to point you to somewhere you can do this. Thibaut posted a comment on my blog with a link, so I'll share it here.


I've not personally tried this, but this looks solid. Let me know how it goes out there.

HOW setup tethering for Blackberry Pearl (8100) on a linux machine (Thibaut's Blog).

Reminder that if you are connecting to AT&T you'll need to use the modem information below in the etc/chatscripts/blackberry conf (the entry above uses T-Mobile's settings)
Modem Initialization String: AT+CGDCONT=1,"IP","wap.cingular"
Dial-up Phone Number: *99#
Dial-up username/password:blank/blank


Keywords: Tether Blackberry, Tether Blackberry Pearl, Tether Blackberry Linux, Tether Blackberry 8100, Tether Blackberry with Cingular, Tether Blackberry with AT and T Wireless, Dialup via Blackberry, Wireless internet through Blackberry, Tether Blackberry with AT&T Wireless, Tether Blackberry with T-Mobile, Tether Blackberry 8100, Tether AT&T, Tether T-Mobile.