An occasional outlet for my thoughts on life, technology, motorcycles, backpacking, kayaking, skydiving...

Friday, December 5, 2008

RPM One-liners

I prefer the apt package manager used by Debian based Linux distributions, but am forced to deal the Red Hat Enterprise Linux professionally. For that, I keep this list handy.

###############
## rpm tasks ##
###############

# Get a (sorted) list of install packages
rpm -qa|sort|less

# find out what version of samba-client is installed
rpm -qa samba-client

# Find out how a certain file got here
rpm -q --whatprovides `locate libmysqlclient.so | sed '1p;d'`
# or
rpm -q --whatprovides `which smbmount`

# Extract files from an rpm
mkdir tmp; cd tmp; rpm2cpio ../pkg.rpm | cpio -id

# import a public key to resolve error like:
# Warning: ...rpm: 3 DSA signature: NOKEY, key ID 5072e1f5
k=5072e1f5; gpg --recv-keys $k; gpg --export -a $k > /tmp/$k.asc; sudo rpm --import /tmp/$k.asc;
# and to verify and clean-up...
rpm -qa | sort | grep pubkey; rm /tmp/$k.asc

##################################
## yum based package management ##
##################################

# add Fedora epel repository to CentOS
wget http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-2.noarch.rpm
k=217521f6; gpg --recv-keys $k; gpg --export -a $k > /tmp/$k.asc; sudo rpm --import /tmp/$k.asc;
sudo yum install epel-release-5-2.noarch.rpm

# find out what versions of samba-client are are available
yum search samba-client

# install samba-client
yum install samba-client

# update an old version of samba-client
yum update samba-client

######################################
## up2date based package management ##
######################################

# Get help on using RPM repositories
up2date|less

# Get a list of all available packages
up2date --showall > /tmp/up2date.all.txt

# Install the package perl-DBD-MySQL from the repository
up2date -i perl-DBD-MySQL

Mysql One-liners

Things I'm tired of googling for...


# pragmatic access to system variables
# 1. There are 2 types of system variables GLOBAL and SESSION
# 2. LOCAL is a synonym for SESSION
# 3. SELECT requires "@@[type].[var_name]" syntax, so you might as well use it for SET also.
SELECT @@global.thread_cache_size;
SET @@global.thread_cache_size=16;

# Investigating the tables on your DB instance
SELECT table_schema, table_name, engine FROM information_schema.tables WHERE engine != 'MyIsam';

# Change password
SET PASSWORD [FOR user] = PASSWORD('some password string')
SET PASSWORD [FOR user] = 'ExistingPasswordHashProbablyFromAnotherServer'

# empty all the tables in a schema (from BASH using my MYsql alias which includes the U & P)
schema=elections; MYsql -hdev1 -B -N -e "select concat('delete from ',table_name,';') from information_schema.tables where table_schema='$schema';" | MYsql -hdev1 $schema

Thursday, November 20, 2008

Command line tool for dpaste

There are lots of snippet hosts sites that are good for sharing in chats. I like dpaste because its interface is simple and effective even if it doesn't have an official API. I wrote this tool to help use it from the command line. Here is an easy way for you to get it:

cd ~/bin #assuming you have a personal bin folder in your $PATH
curl -o dpaste http://dpaste.com/92000/plain/
chmod +s dpaste

If you look at the title for that dpaste "paste" you'll see an example of how to use it:
dpaste command line tool example title
There are a lot of really cool things happening there.

  • The tool published itself

  • It used my OS username

  • It captured the entire command line for the title

  • The command included a Unix pipe

  • The command included process substitution



And to top it all off I landed a really cool, rounded paste number (92000).

Just in case that paste disappears I will also place a copy of the code here:

# In order for the default title to capture the complete command, a shebang (#!) must not be used
usage(){
cat < < EOF
dpaste - a command line tool for posting to dpaste.com
Usage:
dpaste [-h] [-l language] [-t title|-u] [-p poster|-a] [file]

Summary:
dpaste accepts a stdin pipe and posts the content to http://dpaste.com
with the command (complete with pipes) as the title and your username as
the name. If you pass a file it will be sent instead of stdin and the
filename will be used as the title. The following flags are available:
-h
-H Hold until nobody has looked at it for 180 days.
-l language
Specify: Python|PythonConsole|Sql|DjangoTemplate|JScript|
Css|Xml|Diff|Ruby|Rhtml|Haskell|Apache|Bash
-t title
Override the default title.
-u Paste untitled.
-p poster
Override the default Name/Email.
-a Paste anonymously.
-- Denote the end of flags. Needed if filename starts with a "-".

Acknowledgments:
Copyright (c) 2008 Richard Bronosky
Offered under the terms of the MIT License.
http://www.opensource.org/licenses/mit-license.php
Created while employed by Atlanta Journal-Constitution
EOF
}

title=$(history|tail -n1|tr "\t" "#"|sed "s/[^#]*#//")
poster=$(id -un);

while [[ $1 == -* ]]; do
case "$1" in
-h|--help|-\?) usage; exit 0;;
-H) hold="-F hold=on"; shift;;
-l) language=$2; shift 2;;
-t) title=$2; shift 2;;
-u) unset title; shift;;
-p) poster=$2; shift 2;;
-a) unset poster; shift;;
--) shift; break;;
esac
done

if [[ -n "$1" ]]; then
content=$1
title=$1
else
content=/dev/stdin
fi

url=$(curl -s -L -o /dev/null -w "%{url_effective}" \
-F "content=<$content" \
-F "language=$language" \
-F "title=$title" \
-F "poster=$poster" \
$hold http://dpaste.com
)

# copy the url to the clipboard if you are using a Mac
$(which pbcopy > /dev/null 2>1) && echo -n "$url" | pbcopy
echo "$url"

# vim:ft=sh:tw=78

More “Basic Economics”

I saw someone make the following statement on a technology forum discussing expensive Solid State Drive storage: "Why not save that thousand bucks or two so we can help prevent another economic disaster like the one we currently got ourselves into?"

This demonstrates how poorly the average person understands our basic economic fabric. It does not give me encouragement about our future.

A strong economy relies on the exchange of liquid assets. Economic downturns can almost always be attributed to the spending of money that is [merely] speculated to exist in the future.

In non-academic English: Going into debt almost always kills an economy (eventually). (Whether that be the economy of a nation, state, county, city, business, church, or family, it still holds true.) When you go into debt you spend tomorrow's money. When tomorrow gets here*, you are in trouble. This problem is resolved when people spend money they have. That "spending" can be on groceries or fancy restaurants, netbooks or expensive SSDs, charitable donations or investments/savings (which get invested). The only thing you can do with money that is bad for an economy is take it out of circulation. (aka: "Save" it under your mattress.)

Huh? But what about debt? Aren't I contradicting myself? No. Debt is not money. Debt is like anti-money. The collision of money and anti-money is similar to that of matter and anti-matter. Tomorrow finally got here*, and this is what it looks like. Go spend some money. Just do it responsibly. For some that means buying 256GB SSDs. For me that means having $0 debt and socking money into low to moderate risk investments to be prepared for layoffs, retirement, and kids going to college (in that order).

Do not think that luxury items or those who purchase them are evil. That's politics. We have to be smarter than that.

Monday, November 17, 2008

book meme

Obsolete constructs.

Linux in a Nutshell, 5th Edition



Book meme:

- Grab the nearest book.
- Open it to page 56.
- Find the fifth sentence.
- Post the text of the sentence in your journal along with these instructions.
- Don’t dig for your favorite book, the cool book, or the intellectual one: pick the CLOSEST.

via:
- http://leahculver.com/2008/11/13/book-meme/
- http://www.eflorenzano.com/blog/post/book-meme/
- http://justinlilly.com/blog/2008/nov/12/book-memery/
- http://jtauber.com/blog/2008/11/12/book_meme/

Wednesday, November 5, 2008

Entire nation enjoys beautiful weather as God celebrates the election of his spawn

This is an onion-style article that I thought up.

In an unprecedented meteorological anomaly the entire continental United States of America unanimously enjoyed beautiful weather on November 5th. They say "you can't please everyone," but that is exactly what Yahweh pulled off for this post election celebration. The descended man-child President Elect and his surroundings enjoyed a moderate 72 degrees which is, not so coincidentally, the exact temperature that Barack sets the thermostat to in his home. In Georgia they got that "warm in the sun, but cool when the breeze whips" weather that they love. "I know they could use some rain, but let's face it, they can't drive in the stuff", remarked the Lord, "I just didn't feel like killing anyone with stupid traffic accidents." The ski resorts in the Mid-West got the snow they'd been praying for, in an amazing show of Grace upon the red states who did little to embrace the inevitable. "It's not like I couldn't target the snow just on Colorado, right?", he joked, "I'm just not like that anymore, and I haven't been for thousands of years." America has taken to the streets to enjoy this amazing gift from God. Both gifts actually. "I gave Noah a really cool rainbow, but those are pretty gay by today's standards", remarked the deity. He declined to comment on why Alaska was omitted in this gesture of good fortune. Asked about the abortion issue, God said he was "tired of single-issue politics", explained that you could be pro-life and pro-Obama, and then pretended that he was getting an important call.

Wednesday, October 1, 2008

My question for Barack

I just posted my first debate question on Google's Moderator app.

For Barack Obama:
There's a lot of concern about your ties to Marxism. For many, your potential as a black role model outweighs those concerns. Can you assure us that you will drive a message of "you can do anything", instead of "you need the government to help you"?


I don't find much that I agree with in either candidate. So, I feel that out of this election the best potential for good is the effect that Barack could have on black youth. But, if his message is the typical, socialist, "the world is so unfair that you cannot do anything for yourself without my help" then I think he could actually do more harm than good.

Friday, August 22, 2008

Time to stop recommending Netscape! (Revisted)

I've done this before but it seems that things are only getting marginally better. Here is my latest communication with Bank of America...


Even though you claim to support Firefox here: https://onlineeast3.bankofamerica.com/cgi-bin/ias/YpM7nB321ecfIGtkpf6kJTrNlR2sJbviuAJCxUO6359545/2/WelcomeControl?annNumber=0&action=announcement#Ann0

I find that you are still making yourself dangerously liable for recommending 3 browsers for Macintosh users, all of which are not being maintained with security patches... here: http://www.bankofamerica.com/creditcards/index.cfm?template=photoexp_notsupported

Please be aware that I publish articles about these things and I include copies of the form letters you reply with, so I would suggest you put some thought into your response.

Wednesday, June 11, 2008

cron safe bash script for checking URLs (pages) for updates

I needed to monitor a government data source for updates. Of course being a government institution, they haven't caught on to the RSS/ATOM concept so the normal tools for this will not work. (There really should be a "Google Alert" option for this.) This is the simple bash script I whipped up to serve the purpose.

#!/usr/bin/env bash
# pagecheck.sh - intended to be call via crontab (call with -v for verbose) ##

# If you want to override the standard temp dir, define it here.
export TMPDIR=$HOME/tmp

# List the pages you wish to check below, one per line, between the EOFs
pages=`cat < < EOF
http://www.gadoe.org/pea_communications.aspx?ViewMode=0
http://www.gadoe.org/pea_communications.aspx?ViewMode=1&obj=1635
EOF
`
for page in $pages; do
hash=$(echo "$page"|md5sum |sed 's/[^a-z0-9]//gi')
basename=$(basename $0)
name=$basename.cache.$hash
file=$TMPDIR/$name
diff=$TMPDIR/$basename.diff
[[ "$1" = "-v" ]] && echo "Checking $page"
if [[ ! -f "$file" ]]; then
file=$(mktemp -t $name)
echo "Creating cache $file ..."
curl --stderr /dev/null "$page" > $file
else
[[ "$1" = "-v" ]] && echo "Checking against cache file $file ..."
curl --stderr /dev/null "$page"| diff -u $file - > $diff || (echo -e "Found a change in $page\n"; cat $diff; echo "")
patch $file $diff
fi
done
[[ "$1" = "-v" ]] && echo "Done!"

# vim:ft=sh


And to run this script every hour, I modify my crontab (via: "crontab -e") and make it look like so:

MAILTO=me@mydomain.com
#min hour day/m month day/w command
0 */1 * * * /home/rbronosky/bin/pagecheck

# vi:syntax=crontab:ts=8:tw=0


Enjoy! I hope someone else finds this useful.

Tuesday, May 13, 2008

A basic lesson in economics and politics

I posted this as a response to one of many frighteningly uneducated rants about gas prices. Let me be very clear in stating that I am extremely worried about energy costs and its effect on my family. (I have started car pooling 4 days a week and working from home 1 day which is the most my employer will grant.) What I am more worried about is what the dumb masses may do in response to the stress that we are all feeling.



Dan said: "...with all the extra cash being stolen from the consumer..."

Dan, That was a pretty ignorant thing to say. Please post a link to the definition of "stolen" that applies to this situation.

What you must realize is that gouging has nothing to do with profits, it has to do with profit margins.

Let's say your business makes and sells a simple product, like slotted o-rings. You make the product by purchasing non-slotted o-rings and turning them on a lathe. You have brokered a deal with you customers that allows you to have a 10% profit margin. However, a market event has caused the cost of your precursor to double. This means that you must invest twice as much of your capital in the non-slotted o-rings in order to meet your customers' volume demands, which have not changed. Even though you are not selling any more product, you are spending nearly* twice as much each month. (*assuming that you have employees whose wages have not changed) The redeeming factor is that your fixed profit margin of %10 means that your profit nearly* doubled along with the cost of the non-slotted o-rings. At first, your customers will be upset that the cost of your product has nearly* doubled, but when they see the figures they will understand that you are not stealing additional profit. That is, unless your customers are being enticed by politicians/media and your product is a ubiquitous commodity like gasoline.

If you where forced to sell your product at the old price, you would be losing nearly* 40% and would go out of business immediately. If you were forced to lower your profit margin to 5%, you (or your investors) would likely decide that your risk is not worth the reward and choose to invest your capital elsewhere. If your customers' politicians decided to buy votes by promising to levy steeper tax burdens on your "evil profits", you would have to choose to either increase your prices or take profits away from your investors to pay the taxes. If your investors include the pension/retirement investments of virtually every single policeman, fireman, teacher, and anyone else with a lick of sense in this country (as is the case with the oil companies), those taxes on "your profits" actually end up coming out of the very people that the politicians were manipulating in the first place.

These knee jerk solutions to our energy crisis are very dangerous. People like you are going to turn this economic correction/recession into a full blown depression if you get your way. And the socialist politicians will be laughing all the way to the treasury. They will then use the taxes you demanded they take [vicariously] away from you, and use them to implement social programs to provide for you what they feel are your basic needs. From each according to their ability to each according to their need. Of course those with friends in high places will be judged to have greater needs.


Here is an interesting link about profit margins: http://www.gravmag.com/oil.html#dollar

Update: Here is a great article on the matter, that I found after I published this article. http://www.nationalreview.com/comment/taylor200511081818.asp

Thursday, May 1, 2008

Direct download links to Stuffit Expander!

I hate the "you sign up for our newsletter and we will email you a link to the software that handles our proprietary format which nobody in their right mind should be using" business model of this company. I used to use dodgit.com or dodgeit.com for this, but they seem to be up and down a lot lately. Anyway, I figure if they are going to get access to my gmail address, I'm going to blog about it.

As the following link becomes out of date, feel free to add new links to the comments.

http://my.smithmicro.com/downloads/trials/exp-dl-only.html

Wednesday, April 30, 2008

Bookmarklet for copying scriptures from BibleGateway.com

If you've ever tried to copy a scripture from http://biblegateway.com and found that the copyright notice and banner get copied too, this is for you. I have created a Bookmarklet (more about those here) that works on both Firefox and Safari (I don't use MSFT products so I don't know if it works in IE).

Drag this link to your bookmarks toolbar -> BibleGateway Copy Enabled

Many thanks to this thread for saving me a little time.

Monday, March 31, 2008

Time to stop recommending Netscape!

I sent this message to Bank of America today. I think the message needs to get out to more organizations, so let's spread the word.



You need to update your list of supported browsers.

There are several issues here.

  1. Netscape is no longer made by anyone, as stated in this announcement. The most important statement there is "We'll continue to release security patches for the current version of the browser, Netscape Navigator until February 1, 2008", which means that on 2008/02/02 it became a liability to use or recommend the Netscape product. You, as a banking institution, should be concerned about giving advice (browser to use) that if followed could lead to account hijacking.

  2. Microsoft no longer makes nor supports an Internet Explorer browser for Macintosh.

  3. Apple no longer makes hardware capable of running OS 9.



You should be recommending Mozilla Firefox, as does Netscape/AOL, for non-Windows users of the Macintosh, Linux, Unix, and (Free/Open/Net)BSD varieties. Having such outdated information on your website makes you appear to be "behind the curve" on technology and does not garner confidence in future customers. That is a real shame considering that I, as a computer engineer in the internet industry, am very impressed with the display of technology found with Bank of America. The statement made outside your site does not reflect the excellent user experience that is to be found inside.


Screenshot

Why are they putting VGA ports on modern computers?!?

I should start by saying, "I'm going crazy over this now." I'll just get that out of the way.

PC manufacturers are continuing to make computers (desktops, notebooks, ultra-portables, motherboards ATX thru SBC) with VGA ports on them. This is totally ridiculous to do. VGA is an analog output. DVI output is [basically] always actually DVI-I, which carries both analog and digital output. DVI-I can be converted to VGA with an inexpensive passive (no electrical components) adapter. In short, DVI can drive an analog display but VGA cannot drive a digital display.

Why does this matter? Because modern televisions are being made with high resolutions (1920x1080 or 1366×768/1368x768) and no VGA ports. This is perfectly reasonable because those high resolutions require tremendous bandwidth and the analog cables are very prone to interference at those rates. Another consideration is the cost of high resolution Analog to digital converts. It makes no sense to have your video source convert its digital data to an analog signal to be transfered over a highly vulnerable cable, only to be converted back to digital at its destination video display. This brings me to my second point.

All video cards/chipsets start with digital information. They process the information into a digital video signal. The signal is then passed to a D->A converter. Here is where things diverge. The device either:

  1. sends both the digital and analog signals out a DVI port.

  2. trashes the digital signal and sends the analog signal out a VGA port.



Clearly option B is a total waste, and results in the device being worthless for connecting to televisions for use as a PVR, or web surfing device. I am amazed that in 2008 it is still hard to find motherboards with DVI output and it's virtually impossible to search sites like NewEgg and TigerDirect for them.

My intention here is to explain that there is no good reason for putting VGA outputs (exclusively) on computers. I would like to see more people get upset about this so we can influence the market. If I have failed to persuade you, please post a rebuttal so I can revise my argument.

Tuesday, March 11, 2008

Cleaning up Adium

I was having a problem where Adium would not let me speak in group chats. This is quite annoying as it is common practice in my company to use 3-10 way chat with DBAs, SysAdmins, and developers to get a task completed quickly and have a record of the conversations.

I don't know what caused the problem, but I know that reinstalling Adium didn't fix it. I am certain that the problem is the result of moving my ~/Library/Application\ Support\Adium\ 2.0 directory from machine to machine to machine, etc. and trying out lots of plugins.

My goals where:

  1. Save my chat transcripts/logs

  2. Save my 10+ IM accounts so I don't have to re-enter them again

  3. Have a working Adium again



I pulled it off and here is how

# Exit out of Adium
cd ~/Library/Application\ Support
tar cf Adium.tar Adium\ 2.0/
rm -rf Adium\ 2.0/
# Launch Adium
# I do not know if you HAVE to set up an account via the wizard, but I did
tar xf Adium.tar Adium\ 2.0/Users/Default/Accounts Adium\ 2.0/Users/Default/Accounts.plist Adium\ 2.0/Users/Default/Logs


It is important to note that if you have a conversation you need to keep between the time you "rm -rf Adium\ 2.0/" and "tar xf..." (in the same day, because Adium logs are created 1 per contact per day) you will need to create a second tar and merge the log manually. I had to do this with about 12 conversations because I let 2 days go by before I attempted to recover the backup.

Monday, March 10, 2008

Baby prep is in full force.

I'm starting to enter that crazy preparation phase as we prepare for baby #2 (second girl) in July. I'm starting wish I would have had the fore-sight years ago to say, "No honey I don't feel comfortable [installing light fixtures/sconces/switches, crown molding, building built-in cabinetry, sewing Roman shades, etc.]"

The 23 year old who wanted to his wife's Super-man is now her Advil-man.

Anti-Virus, why?

If you believe that there is a "grand design" to the universe then you must conclude that viruses exist for the purpose of population control. I'm against anti-virus software because I believe it violates the "natural order" of things. If permitted to do so, viruses will restore balance to the wreck that is the current market share prospectus.

Why does mankind always feel the need to "play God"? ;-)

Monday, February 18, 2008

I do RTM!

It's not that I don't RTM. It's just that my skimming sucks!

After I couldn't find this in "man curl", I found this explanation. Then I was able to find "--data @foobar" in the man page.

~/$ history|grep 'man curl'
645 man curl
1325 man curl
1327 man curl
1446 man curl
1456 man curl
1467 man curl
1472 man curl
1509 man curl
1663 man curl
1664 history|grep 'man curl'

Followers