Posts Tagged tip
MCOD – 6.6.10 – Macbook Pro Core i5/Core i7 Battery Fix
Posted by Jon Zobrist in Mac Command of the Day, Macintosh on June 6, 2010
Core i5/i7 Macbook Pro battery life problem description and fix.
Click to continue reading “MCOD – 6.6.10 – Macbook Pro Core i5/Core i7 Battery Fix”
MCOD 5.11.10 – Clear network settings on a Mac in OS X
Posted by Jon Zobrist in Mac Command of the Day on May 11, 2010
I got a new MacBook pro, one of the core i5 ones, and transferred all of my data with time machine restore, which is absolutely awesome, btw. But my ethernet interface never worked! Being the IT guy I need my ethernet interface to work, so I searched online for someone else who had the same problem. Unfortunately, everything I found was simple fixes for simple problems. So I made an appointment with the mac genius hoping they could solve my problem, and they did.
They went to my hard drive->Library->Preferences and deleted the folder there called “SystemConfiguration”
Then rebooted, and viola, a working ethernet interface.
So, what must have happened to break mine, is when I restored my mac with time machine, it confused the network interfaces somewhere. The interface showed up, but always said ‘cable unplugged’. I had tried everything; deleting the interface in the network section of system preferences, configuring the interface with ifconfig in Terminal, creating multiple interfaces, rebooting, different cables, different networks, and different locations. The time machine had restored my network config folder and prevented OS X from correctly seeing the right interface.
The Mac genius said it can also help if you’re having problems staying connected to a wifi network.
Hope this helps!
Update 6/7/2010:
Here is a good article on troubleshooting your Mac OS X wireless networking at osxdaily.com
LCOD – 4.12.10 – Quick Mysqlreport to e-mail setup
Posted by Jon Zobrist in Linux, Linux Command of the Day, MySQL Server Support on April 12, 2010
This will be a quick install to setup your server to e-mail you daily mysql reports using the cool mysqlreport application at hackmysql.com
Click to continue reading “LCOD – 4.12.10 – Quick Mysqlreport to e-mail setup”
LCOD – 5.9.07 – Updating CPAN in Perl
Posted by Jon Zobrist in Linux, Linux Command of the Day, Perl, Programming on May 9, 2007
Perl rocks, it’s easily my favorite programming language. One of the nice things about Perl is the CPAN (Comprehensive Perl Archive Network). Your Linux box has CPAN installed already, and to begin using it you should first update it. To do so run the commands just below. The first time you invoke CPAN it’ll launch the configuration module, just hit enter until it gets into the part about which mirrors you want to use, it’ll have you pick geographic areas first, and then tell you to enter servers by number, separated by spaces. I usually put in about 20 servers, which looks like kinda this
30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10
#invoke perl’s CPAN shell (and first time configuration with)
bash$ perl -MCPAN -e shell
#once configuration is done, update CPAN, and then reload
CPAN> install Bundle::CPAN
CPAN> reload cpan
Now, head on over to CPAN and search for some cool new Perl modules to play with!
A great place to dive into the world of Perl is Perl.org
Also the Perl Monks is a good Perl site, and Use Perl is as well.
Make sure you have a correct build environment setup, on Ubuntu/Debian you need to install the build-essential package (sudo apt-get install build-essential)
LCOD – 3.12.07 – Speeding up your DNS queries
Posted by Jon Zobrist in Linux, Linux Command of the Day on March 12, 2007
To change to use OpenDNS instead of your own, or worse! your ISP’s crappy, poorly maintained dns server, you can follow the instructions here.
http://opendns.com/start/
The basic info is to put in these 2 IP’s as your dns servers
208.67.222.222
208.67.220.220
On Linux/*BSD you’d put them in your /etc/resolv.conf file like this
nameserver 208.67.222.222
nameserver 208.67.220.220
If you’d like to double whammy your performance run a local cache, I use DJB’s djbdns dnscache in forwarding only mode, as described here.
http://cr.yp.to/djbdns/run-cache-x-home.html
With the above IP’s in the @ file.
Installing DJB’s stuff is cake, you can pretty much cut & paste his instructions found here
http://cr.yp.to/djbdns/install.html
Of course you’ll need Daemontools, and ucspi, install instructions (cut & pasteable) here
http://cr.yp.to/daemontools/install.html
http://cr.yp.to/ucspi-tcp/install.html
If you get compilation errors cuz DJB hasn’t fixed a bug in his code and some systems (lots of recent Linux systems), run these commands.
(run after you’ve extracted the archive, and cd’d into it’s directory, and run for EACH install.) You may get a no such file for the src one on some, but he mixes software locations, so just run em both.
perl -pi -e ‘s/extern int errno\;/\#include <errno.h>/’ *
perl -pi -e ‘s/extern int errno\;/\#include <errno.h>/’ src/*
Enjoy!
LCOD – 2.18.07 – Simple command line perl substitutions
Posted by Jon Zobrist in Linux, Linux Command of the Day, Perl, Programming on February 18, 2007
first, make a file that lists all the images (we’re using *jpg, but you could do *gif, or *coolimages*, or just * for all files in the dir – note: all files in dir * with a redirect will catch the file you are redirecting to, and it will likely need to be removed)
From the shell / command line, run:
/bin/ls *jpg > ourfiles
Now the fun part! This will take a line like this
picture1.jpg
And make it look like this
<a href=”picture1.jpg”><img src=”picture1.jpg” border=”0″></a>
From the shell run / command line, run:
perl -pi -e ‘s/^(.*)$/<a href=\”$1\”><img src=\”picture1.jpg\” border=\”0\”><\/a>/’ ourfiles
The basic pattern of this command is
‘s/SEARCH PATTERN REGEX/REPLACEMENT PATTERN/’
The search pattern is a Regular Expression, and the Replacement Pattern needs to have any special characters escaped (including / $ # @ “) with a \
The Search Pattern we’re using is a simple one ^ for start of line, (.*) for . anything and * any number of times, with paranthesis around it to put it into the perl variable $1, and $ for end of line.
LCOD – 2.5.07 – Debian package management
Posted by Jon Zobrist in Linux, Linux Command of the Day on February 5, 2007
List all packages installed in a Debian system, piped to more for readability
dpkg -l | more
(dpkg dash lower case L pipe more)
Seach installed packages for ones containing the word foobar
dpkg -P /*foobar/*
This info from this site
http://electron.mit.edu/~gsteele/debian/
LCOD – 10.28.05 – Howto speed up RAID 1 rebuild w/links
Posted by Jon Zobrist in Linux, Linux Command of the Day on October 28, 2005
This should be in EVERY linux RAID howto
echo -n 500000 > /proc/sys/dev/raid/speed_limit_max
Because it defaults to sooo slow to fix raids.. and you can just turn it up… so lame that it’s not in every howto.
It is in this howto http://togami.com/~warren/guides/remoteraidcrazies/
Which has a few steps I didn’t use, using Gentoo, but was a great walkthrough…
LCOD – 5.9.05 – mounting cdrom (iso) images transparently
Posted by Jon Zobrist in Linux, Linux Command of the Day on May 9, 2005
mount -o loop /path/to/cdimage.iso /mnt/imageX
that’s it, of course you’ll need a kernel with loop support, but most modern linux’s have this built in.
This lets you save a CDR and get faster access to CD media you’ve downloaded. I use this at work to install Oracle from the hard drive remotely instead of having to be on side swapping CDROM’s.
Also, if you have a CD that you’d rather have an iso, here’s how to rip iso’s easy like..
dd if=/dev/cdroms/cdrom0 of=/path/to/cdimage.iso
you may went to grep cdrom /etc/fstab to see what the device is of your cdrom. Also, I’ve had some problems with this failing with copy protected type cdroms, sometimes if you mount it first it works better, sometimes worse.
LCOD – 5.2.05 – Removing ^M from WINDOWS text files
Posted by Jon Zobrist in Linux, Linux Command of the Day on May 2, 2005
This you don’t type ^ you hit CONTROL.
:%s/^V^M//
so you type
:%s/CONTROL-V CONTROL-M//ENTER
ALSO:
You get a file with ^M at the end of every freaking line, and open it up in vi and want to just rip off the last line
This you don’t type ^ you hit CONTROL.
:%s/^V^M//
so you type
:%s/CONTROL-V CONTROL-M//ENTER