lawlRedneck

May 27, 2010

nerdcred++

Filed under: nerdery —— elmidgeto @ 6:41 am

Well, once again, I needed to find a solution to a non-existent problem. Well, almost non-existent.

The other day we had a rather unique error when trying to restart an Apache process. A stop command was issued, the process died off in the process list, but an orphaned session was keeping the http port tied up, so Apache could not restart.

What to do?

Well, given my awakening and increasing knowledge of the various commands and utilities in Linux, the only solution was to over-engineer a fully automated solution I could incorporate into a maintenance script.

With no further adieu, I give you a completely hands off way to kill the process holding on to a given port.

sudo -S kill -9 `sudo -S netstat -lpn < $SFL | grep :80 |  awk ' { split($7,pid,"/"); printf("%s",pid[1]) } '` < $SFL

$SFL is the absolute location of a file containing the sudo password of the account used to run the command(s).

Fairly simple, and overly engineered solution, so the only proper title was of course, nerdcred++. Anyone else have a more elegant solution that can be used in an automated script, and without the httpd.pid being in existence?

July 8, 2009

sftp/scp scripting

Filed under: nerdery —— elmidgeto @ 4:15 pm

The situation: I need to move files from one server to another using only the OpenSSH tools. All authentication/authorization is done via public key handshakes.

The restrictions: I cannot use expect or any other scripting language beyond shell scripts.

The goal: To minimize the number of characters I need to type and provide a platform for our batch guy to build on for the automated transfers.

And without further ado, have at thee. (Note: I did remove username, sftp connection string, and the root paths from my script to eliminate identification)

#!/bin/bash
######################################################
###### Utility script for Pushing/Pulling files ######
###### from the enterprise sftp solution. ############
######################################################

##################################################
############# SETTING THE VARIABLES ##############
##################################################

TYPE=$1
FILENAME=$2

USER=”"
SFTP=”"
BASEPATH=”"

SFTPPATH=$BASEPATH
LOCALPATH=`pwd`

MAX=$#
ARGS=(“$@”)

for ((COUNT=2; COUNT < MAX; COUNT++))
do
 if [ ${ARGS[$COUNT]} == “-s” ];then
      SFTPPATH=$SFTPPATH/${ARGS[$COUNT+1]}
      COUNT=$COUNT+1
 
 elif [ ${ARGS[$COUNT]} == “-l” ];then
      LOCALPATH=${ARGS[$COUNT+1]}
      COUNT=$COUNT+1 
 fi
done

##################################################
########### COPY FROM THE SFTP SERVER ############
##################################################

if [ $TYPE == "GET" ]; then
     scp $USER@$SFTP:$SFTPPATH/$FILENAME $LOCALPATH/$FILENAME

##################################################
############ COPY TO THE SFTP SERVER #############
##################################################

elif [ $TYPE == "PUT" ]; then
     scp $LOCALPATH/$FILENAME $USER@$SFTP:$SFTPPATH/$FILENAME

##################################################
########## DELETE FROM THE SFTP SERVER ###########
##################################################

elif [ $TYPE == "DEL" ]; then
     sftp -b /dev/stdin $USER@$SFTP <<INP
     cd $SFTPPATH
     rm $FILENAME
     ls
     bye
INP

##################################################
############### SCRIPT ARGS HELP #################
##################################################

elif [ $TYPE == "-h" ]; then
     echo “  sftp_util syntax is:”
     echo “  ./sftp_util.sh <GET|PUT|DEL|-h> <FileName> [-s] [-l]”
     echo “  GET GET is used to retrieve a file from the remote server.”
     echo “  PUT PUT is used to place a file on the remote server.”
     echo “  DEL DEL is used to delete a file from the remote server.”
     echo “  -h -h is used to print this help menu.”
     echo “  -s -s <sftp server path of/to file, do not include a leading ‘/’ (ex. test/test2)>”
     echo “  -l -l <sftp server path of/to file>”
 
else
     echo “Please use ./sftp_util.sh -h for help”
fi

Usage goes a little something like this:

server1$> ./sftp_util.sh PUT file -s test/empty_dir -l /home/user

server2$> ./sftp_util.sh GET file -s test/empty_dir -l /here

server2$ ./sftp_util.sh DEL file -s test/empty_dir

 

Nothing overly fancy, just a quick little script to save me time and have a bit of fun on a slow work day.

May 28, 2009

The Nashville Life

Filed under: Uncategorized —— elmidgeto @ 7:05 pm

I suppose I ought to post something so people don’t off and assume I died on the barren plains of Wyoming.

Some of you may be aware I moved to Nashville, Tennessee for a job offer doing something similar to what I was doing in Wyoming (and if you weren’t aware of it, you are now).

Work has been keeping me busy so I haven’t been up to much else. I somehow managed to get promoted with like seven times the work and no real promotion, but I wound up being responsible for establishing and testing the connections between our application and external agencies and providers, in addition to my other work.

So aside from the oppressive, gawdawful heat and humidity, the south is actually a nice place. People are really friendly (I can’t count the number of random honest to ganesh conversation that start in the elevator) even if they can’t drive. Still looking for my camera to prove to the shirtninja that the scenery down here is far surpassing anything to be found in South Dakota.

Other than that, wedding thingy coming up, and then when I return hopefully I will muster the motivation to finish my rifle, do some load development, and shoot a barrel or two out of it.

February 12, 2009

Listening to what now?

Filed under: Uncategorized —— elmidgeto @ 6:23 pm

I’ve always had a rather ecclectic taste in music. My music collection has everything from Acid Trance to Jazz to classical to Country (and Western, probably one of very few my age that still knows the difference =P) and even more.

 

Lately I’ve been on a bit of an odd kick, even for me. The last few days I’ve been listening to The Cruxshadows, an Industrial band from over europe way.

http://www.youtube.com/view_play_list?p=7F12EEC7D7BEF462

 One nice thing about youtube is it allows you to explore new music and set up playlists and favorites so you don’t have to go to the hassle and hit/miss of trying to pirate music before deciding to buy it. There’s the youtube playlist of most of the Cruxshadows songs I have been listening to lately. I highly reccomend Winterborn, Eye of the Storm, A Promise Made, and Dragonfly. Simply some of the best musical lyrics I have ever heard.

February 6, 2009

blargh…

Filed under: Uncategorized —— elmidgeto @ 1:42 pm

Been a while since I have posted anything, let alone anything of note. Not for lack of “interesting” things happening no doubt, just haven’t had the motivation.

Interesting happenings since October:

Busy at work -> project cancelled.
Broke my foot.
Laid off in the RIF.
Spent a bunch of time with family over christmas, it was amusing watching my nephew go nuts anytime anyone went near my foot since he had been told in no uncertain terms to stay away from it.
Spent a few weeks looking for a job.
Was offered a position at a different project with the same company I worked for.
Accepted said job and have been impatiently waiting for paperwork to make its way through HR so I can be reinstated.

So, soon I will be commuting from Wyoming to Tennessee and waiting for some form of relocation assistance to move down to Nashville permanently or until I get RIF’d or transferred again.

October 4, 2008

First foray into the world of custom rifles

Filed under: Firearms —— elmidgeto @ 11:05 am

About four months ago, I took some parts and pieces of to a semi-local smith to have a rifle created out of them. The idea was to have a hard use rifle, open-sights, and based on the mauser action. The caliber was ultimately decided on as .338-06, which is a .30-06 Springfield necked up to accept a .338″ bullet.

The metal work was done by Jef Rice of Rhys Precision Gunworks, and he also Cerakoted it armory black. The stock was the take off from the donor rifle, and is a placeholder for testing and verification. The action is an Interarms Mark X and the barrel isa #3 contour Shilen 1-10 twist .338″ finished at 23″ length.

The rear sight is a Williams FP aperture sight, and the front sight is a NECG Universal Screw on ramp that wound up having to be silver soldered on due to the wall thickness of the barrel. The original Interarms safety/trigger was tossed in favor of a Timney Featherweight and a 98 Mauser flag safety.

All that is left is to finish it out with the proper stock, currently leaning toward either a McMillen or a Bansner/HTS with a Boyds JRS laminate being a distant third.

August 21, 2008

20 Years too late, or G’Damn GM

Filed under: Trucks —— elmidgeto @ 11:08 am

So, of late I have been browsing around looking at new vehicles in hopes of maybe finding one to replace my current ’97 Pickup after I get out from under all these medical bills piling up.

My criteria so far has been pretty simple, or so one would think.

- Manual Transmission

- 4wd but not auto-trac or similar 4wd

- The engine has enough torque to maintain decent fuel efficiency for the weight of the vehicle.

- Must be able to get me up and down the mountains in october in any weather that may pop up, up to and including 3 feet of snow pouring in, with a weeks worth of gear, and 500lbs of elk in a cooler.

Seems pretty simple, right? Well, it would seem that every body that makes a 4 wheel drive is dropping the manual transmission, or doing something supremely stupid like Toyota and coupling the manual with auto-4wd.  GM stopped offering manual transmissions in ’06, the aforementioned Toyota FJ has auto-4wd, Dodge just dropped all manuals in half ton pickups, and ford only has the manual in their 4.8L Triton half ton. So my choices have become pretty damn narrow.

- Dodge 3/4 ton with the Cummins I6 Diesel

- Ford 3/4 ton with either the PowerStroke or the V10 Triton.

- Jeep Wrangler Rubicon or Rubicon Unlimited

- Modify my ’97 to build what I want

So far, the Jeep Wrangler is leading by a narrow margin just due to the fact, I don’t actually use my pickup like a pickup anymore, but we’ll just sit tight and wait for the ’09 stuff to come out, and see what kind of interesting things come forth.

Or maybe, something brand new will come out and spin all my research about, or someone will come up with an option I hadn’t thought of.

July 16, 2008

Thoughts on the One Rifle

Filed under: Firearms —— elmidgeto @ 7:19 pm

Browse to any forum, magazine, or encyclopedia online, and ask a simple question; what is the best gun for someone who will only purchase one. The answer is almost universally .30 Gov’t of ’06. More commonly called the .30-06 or simply the ought six.

While, there is good reason for this recommendation, and there is good reason that the .30-06 has been the number one selling rifle cartridge nearly since its inception, it may not be the best all around cartridge for the one rifle hunter. Granted, All of the following is just my opinion, and may not apply, but I’m bored, and obviously so are you, so let’s explore the why and wherefore.

Let’s start off with the brand of rifle. In my opinion, the Remington Model 700 is the ‘can’t be beat’ of the one rifle hunter. My reasons for this are simple, and have everything to do with logistics. First, the 700 is popular everywhere, so if something breaks you have a greater chance of finding parts, and/or a smith to fix it on the road.

Next off, the chance of getting a remington that will shoot well is high, and if you get a lemon there are many more readily available options to get it shooting to your satisfaction, ranging from quick warranty work to letting a gun plumber do his thing.

Lastly is the customizability; there are so many available aftermarket parts custom and off the shelf that it is impossible not to make a 700 fit you like it was custom made for you.

 A lot of guys will hem and haw, and argue why this gun and that gun are better, and in truth, they might be right, but remington has a formula that’s worked for them for a lot of years now and it’s hard to argue with their track record.

 

Now that we’ve got a rifle picked out, let’s choose a caliber. Two calibers spring to mind immediately: 7mm-08 Remington and .270 winchester. My first choice would be the 7mm-08 Remington and here’s why, it’s an easy recoiling cartridge that anyone should be able to pick up and shoot with enough oomph for those oh chit situations when something goes pear shaped.

The 7mm is popular enough in various flavors for there to be good bullets for every concievable type of game a one gun hunter is likely to persue, and factory ammo is readily available most anywhere. While the 7-08 may not be as versatile and ready for the big bears as the .30-06 or .308 is, but it can, will, and has handled everything else in north america.

The .270 made my list because it has a very slight bit more recoil but it trumps the 7-08 for ammo availability.

So there you have it. You now know what rifle and caliber i would buy if I could only have one rifle to hunt with, god forbid.

June 26, 2008

DC v. Heller

Filed under: Firearms —— elmidgeto @ 8:41 pm

So, it’s been a good day.

 The US Supreme Court ruled that a prohibition on the ownership of handguns is unconstitional and that the Second Amendment is an individual right.

Held:
1. The Second Amendment protects an individual right to possess a firearm unconnected with service in a militia, and to use that arm for traditionally lawful purposes, such as self-defense within the home.

There’s a lot more work to be done, but at least it gives solid footing to start pushing back and regaining ground taken “for the children.”

Another couple quotes from the decision that I find humorous:

“Some have made the argument, bordering on the frivolous, that only those arms in existence in the 18th century are protected by the Second Amendment. We do not interpret constitutional rights that way. Just as the First Amendment protects modern forms of communications, e.g., Reno v. American Civil Liberties Union, 521 U. S. 844, 849 (1997), and the Fourth Amendment applies to modern forms of search, e.g., Kyllo v. United States, 533 U. S. 27, 35–36 (2001), the Second Amendment extends, prima facie, to all instruments that constitute bearable arms, founding.”

“We find [the words of the Second Amendment] guarantee the individual right to possess and carry weapons in case of confrontation.”

 

 Link to the Full Decision

lawlRedneck is proudly powered by WordPress running on http://blogs.dootdoot.com.
Create a new blog and join in the fun! Entries (RSS) and Comments (RSS).