One line "web" server with netcat

pave-hawk-header

I had to fake out an F5 load balancer the other day just to verify that it was routing correctly, and the app folks didn't have any code yet for the Tomcats to even start up.

I put this together quickly to emulate the F5 healthcheck they were expecting and then curl'ed the VIP to see my traffic come through once the LTM decided all the backend nodes were healthy.

nc -kl 8080 -c 'echo -e "HTTP/1.1 200 OK\r\n$(date)\r\n\r\n";echo "<p>Success</p>"'
or make a real index.html and pipe it back like so:
while true ; do nc -kl 80  < index.html ; done
index.html:
HTTP/1.1 200 OK\r\n$(date)\r\n\r\n
<p>I am Groot!</p>
You can set these up in place of tomcats/apache/whatever and fake out the health checks and get a vip up and tested without the actual app. Think "basic functionality":  pool members, health check, vip, load balancing.
Posted in bash, example, linux, performance, script, varnish

Mac OSX Dock has a line that won't go away.

pave-hawk-header

I've been seeing these lines under the "Downloads" icon and the "Trash" icon and they change now and then, but won't go away. A reboot might fix it, but I'm a bad "User", I never reboot unless the thing crashes on me.

Screen Shot 2015-07-07 at 3.04.01 PM I know my Trash bin is corrupt, I have to empty the trash from a terminal. But downloads is ok otherwise. Turns out it's just a bug in the Dock.

If you want to get rid of the lines, just open a terminal and run "killall Dock". The Dock will go away and all your windows will un-minimize (sorry) and the Dock will come back and the lines will be gone!

Maybe they'll fix it someday.

 

Posted in mac

Splitting large files in Linux or Mac

pave-hawk-header

split –bytes=1024m /path/to/BigFile LittleFilePrefix

it doesn't understand GB, so use 1024m if that's what you need.

Putting them back together, if needed, is:

cat prefix* > newfilename

Posted in linux

Brighthouse/Charter/Time Warner Samsung "this cable box not authorized for service" fix

pave-hawk-header

After a week of phone calls and techs at the house, and 4 replacement cables boxes, I finally got "The Guy" on the phone that knew what the problem was and knew how to fix it.

We replaced a failing Samsung box that would reboot and freeze all of a sudden, and then went through 3 replacement boxes that never made it past the "The cable box is not authorized for service, please call..."

We called, and requested "Box Hit" and "Adapter Reset" and "Activate Service" many, many times, and never got anywhere. Went through 3 people on the phone and most could not even get the box to see a simple reset, most could not even see it. We pulled all new RG-6 in the house where we needed it, most already was. The two Cisco DTA's and Scientific Atlanta 3250 all worked properly and would see the resets. The new Samsungs wouldn't get past the gray screen.

Here's the fix that "The Guy" put in. It's reassuring when you call with something goofy that no one has been able to fix, and they say "I know exactly what this is! Give me a moment to fix it." The others were nice enough, but could only click here, click there to no avail. The online site knew the serial numbers, but oddly, could not see ANY of the 4 boxes. Turns out, that was the problem. They had hosed up the account when we replaced the *first* box. They added the new one, and removed the bad one. In whatever system they use, that meant that we no longer had a primary cable box, and that freaked out everything from that point on. The Cisco's are simple DTA's and booted up fine. The SA 3250 is self contained and boots up pretty quick. The Samsungs basically PXE boot over the network like a thin client, and rebuild themselves with every boot. However, since there was no primary box, our account was broken as far as remote booting was concerned. I'm sure the cable folks can fill in the blanks, but that was the problem. He removed all four, added the Samsung as #1 and marked it as primary, and added the others. We rebooted the box and got the unauthorized again, but he was now able to see it and send another reset and a reload and the box finally came up properly!

Woo hoo! And, they are crediting us for the week that we had no service. Overall frustrating, but they weren't as bad as everybody says. It was just a stupid computer error. If it wasn't for those, I'd still be doing chemistry.

Maybe they'll get my cablecard activated properly next week...

Posted in linux

Scanner to Evernote trick

pave-hawk-header

Want to save time getting your scanned items into Evernote the easy way? If your phone pictures aren't high res enough to take legible photos of documents, and you have a newer all-in-one scanner, you can do this:

  1. Configure the "Scan to e-mail" feature of your scanner. Make sure it works.
  2. Go into Evernote, and find your "Email notes to address" in the Account Info, it should look something like [email protected]
  3. Add that email address into the address book for your scanner
  4. Don't be surprised if you need Evernote Premium pretty quick after doing this... You may want to set the scanning settings to text or OCR.
  5. Scan away!
  6. Evernote should run OCR on the documents, but this can take a while to complete. For the most part, it just works "Later", which is good enough for me!
  7. Profit!

 

Posted in evernote

Yeah, that pretty much sums it up.

pave-hawk-header

Got this today:

>>> import lxc
__main__:1: Warning: The python-lxc API isn't yet stable and may change at any p

Yeah, the API changed mid sentence apparently.

Sooo tired of "Frameworks" and "API's" and "Interfaces" when all I want is a COMPLETE WORKING PRODUCT.

Posted in linux

Mac starts up to black screen or reset password screen

pave-hawk-header

This morning my MacBook Pro with Yosemite had issues starting up. I had run the battery down to 10%, which on mine means it's dead and shuts off hard. This has bitten me before, so I know the trick is to let it charge until at least one light on the battery status lights (on the side of the laptop) is on solid, THEN power it back on. I heard the Wall-E sound, and the screen stayed black. Tried an external VGA dongle, no screen at all. Hard booted it again (power off, power on), got a "Would you like to reset your password?" screen. No, I don't. It had three options, none of which were appropriate. #1 Would only let me enter my password to remove disk encryption (no can do, company owned laptop) #2 and #3 were variants of "my keyboard doesn't work". Click the back arrow appears to hang the app with no selections possible anymore. Hmmm.

Rebooted it hard again, black screen. Again, reset password. Hmmm again.

Ok, clicked back again on the password app, still hung up. Bump the top of the screen and there's an Apple menu! Shutdown or Reboot are the only options (as I recall). Both do what they say, neither fixed this issue.

Get ready for the weirdness.

Reboot to black screen, nothing there. I read something on a site that recommended the following, and it's the craziest Mac workaround I've ever seen.

The black screen is indeed black, BUT the laptop is alive and waiting for your disk decryption password! If you only have one user, you might be able to click dead center and blind-type your password to boot it up. Since mine is corporate-owned, there are a couple of accounts including an admin account, a guest account and my own so it's hard to find where to click.

Cue the weird. Get out your handy phone, and turn on the flashlight app. Shine the flashlight through the Apple on the lid side of the screen. You can now see that little section of the screen using your flashlight as the backlight! The laptop is on, but the backlight is still off! Use the flashlight and use the up/down/left/right/enter keys to get to your user on the selection screen, and then carefully type in your password. Mine chugged for a couple of seconds, realized the backlight was off and turned it back on, and booted up the rest of the way! W00t! Problem solved!

And you thought the Apple on the back was just for decoration!

Posted in hardware, mac

Warning

Anybody says "(verb) ALL THE THINGS!!" to me, and I'll break all your things.

That is all.

 

Posted in linux

Quick and dirty node.js setup

pave-hawk-header

Apparently node.js is the new, or not-so-new, hotness.


As a programmer, you're probably all excited. As a sysadmin, it's boring, but at least it's fast and not as bloated as half the crap out there. It has the extra added feature of not blocking while waiting for input and events to finish. It also has a fun feature of exiting once in a while when you devs don't catch things. You're basically running a server with javascript, and the new devopsy way of doing things is to build your framework, based on someone else's framework, get it 85-90% done and release it as a new framework.


To paraphrase Lewis Black: "If you were a contractor, and you sold me a framework as a new house, you would still be doing time."


No one seems to finish anything anymo



Download node from here:

http://nodejs.org/dist/v0.11.16/node-v0.11.16-linux-x64.tar.gz

(or newer, obviously)


ç

node –version

v0.11.16



vi test.js


Paste in:

var http = require('http');

http.createServer(function (req, res) {

res.writeHead(200, {'Content-Type': 'text/plain'});

res.end('Hello Worldn');

}).listen(8080);

console.log('Server running at http://thismachine:8080/');


save it



then run:

node test.js


From another box/ssh session:

curl http://127.0.0.1:8080/

Hello World



You should be good to go, press Control - C twice to kill the node app.


Install the forever app to keep things running if they fall over dead. It's almost as if this is a client side scripting language that they made into a server...


npm -g install forever


It will sort out the dependencies and install them all:

[root@BDC8-L-503133N ~]# npm -g install forever

/usr/local/bin/forever -> /usr/local/lib/node_modules/forever/bin/forever

[email protected] /usr/local/lib/node_modules/forever

Posted in linux

Outlook 2011 To Evernote cheat sheet

This is from Veritrope.com, Go HERE and get the script directly.

Getting important emails directly into Evernote from Outlook for Mac. This was built into the Windows version but the Mac version doesn't have it.

Go to the link above and download the script like he says. For the ADD among you, myself included, here's what you're going to miss:

  1. Go to Outlook on the Mac
  2. Click on the AppleScript icon (far right)
  3. Click "About this menu" (who names these things?)
  4. Click "Open Folder"
  5. Leave that for a moment, and open the Script Editor on your Mac
  6. Paste in the script from the site
  7. File - Save
  8. Choose your Desktop if it didn't default to Outlook Script Menu Items
  9. Name it:  "Send to Evernote\mE.scpt"  (note this is WRONG on the site, it's missing the \  )
  10. Note, that gives Outlook a Command + E shortcut to send the item to Evernote
  11. Close the Script Editor
  12. Locate and drag "Send to Evernote\mE.scpt" on your Desktop and drag it into the "Outlook Script Menu Items" folder
  13. Close the "Outlook Script Menu Items" folder
  14. Find an email and press Command+E and off you go!

Write a thank you to Justin on his site! Personally, this saves me a ton of time and will donate to him when I have the chance.

Posted in evernote, mac Tagged with: , ,

Layer 8 Consulting

Layer 8 Consulting was formed to provide experts and expertise to small businesses needing professional support for their networks, web hosting, computers, and virtualization needs.