Four Years of Conditioning

So I just started a new job and its made me realize a few things. First is that I was at the previous gig for far too long, just over 4 years to be precise. That is an awful long time now that I actually sit down and think about it, four years of driving an hour each way to get paid enough to make ends meet and buy a house along the way. A whopping 49 months of dodging crazy drivers on the highway, sitting in traffic behind an accident and twitching at every deer on the side of the road at night.

Despite that long duration its taken only a few days at the new place to realize just how badly I have been messed up by the previous employer. Its not even that the direct supervisor or manager were bad people, to be honest their hands were mostly tied by the corporate structure in place that moved at the pace of drunken dinosaurs in tar. One of the biggest things is the change in lighting, the new office is so bright it sometimes bothers my eyes if I don’t look at something dull like a piece of paper or my matte black new Dell laptop. While I’m thinking about laptops let me contrast the previous with the new; HP Elitebook i5 w/ 4GB of RAM and Windows 7 x32 (with a flat out refusal to update to x64) versus a brand new Dell i7 w/ a 256GB SSD and 8GB of RAM and an x64 version of Windows. You would think over 4 years the hardware would have been updated but somewhere along the line a policy was put in place that you had to justify updated equipment, so instead of getting a new machine at 3 years I was told to suck it up.

Without going through every little difference the main point I am making is that I didn’t realize how bad I really had it at the previous job until I finally left. Sure I miss the people I worked with, they were probably the only reason I managed to make it to the four year mark. But now I can’t help but shake this feeling that the other shoe is waiting to drop at the new job, that some dark secret or terrible truth is waiting to spring free when I finally let my guard down and accept that not every employer is a monolithic behemoth of bureaucracy that that treats its employees more like prison inmates than actual free people doing a service for them. This of course is not healthy in the least bit, but it is what it is and I have to fight every day to not let that negative voice inside my head be the loudest.

Extended Regex and Bash variables

So it seems that lots of people have posted about how to use regex when invoking sed, however they forget that most of the good things are restricted to extended regular expressions, so here is a quick illustration of how to get extended regex and bash variables in the same line for sed.

The important part is that -r, which lets you use extended regex. Also by enclosing the pattern in double quotes instead of single you can use system variables which makes this very handy for doing replacements on incorrect config files that automation might have mangled.

Find RHN contract number on a live system

This only really works on systems utilizing subscription manager, but it works and its handy

[root@server1 ~]# subscription-manager list --consumed

+-------------------------------------------+
Consumed Product Subscriptions
+-------------------------------------------+

ProductName: Red Hat Enterprise Linux Server
ContractNumber: 1458961
SerialNumber: 171286550006020205
Active: True
Begins: 2009-01-01
Expires: 2011-12-31

Imgur Album to PDF

So you just found that awesome recipe on imgur, or a slick DIY wifi antenna that you want to make? Then this script is the ticket for you, it grabs an entire album and makes a handy pdf out if it complete with terrible formatting and half-assed image resizing .  It will need imgurpython, PIL, reportlab, requests and shutil along with some patience to build with pip and resolving dependencies.

Also if you are so inclined this is hosted at Github as a Gist

ComputerCOP and your local police force.

https://www.eff.org/deeplinks/2014/09/computercop-dangerous-internet-safety-software-hundreds-police-agencies

The fact that the police are distributing this software is absurd (most of them barely know how to use a computer beyond basic web surfing) but the fact that they are pissing away our money on it is the real salt in the wound. I really hope anybody who reads this takes a moment to check if their local agency has taken part in distributing this spyware and does their part to raise local awareness to the flagrant violation of privacy as well as the absurd waste of tax payer money on an attempt to further erode our rights.

Food for thought

I stumbled across this on Reddit, and its certainly worth reading at least once. All too often I see people claim that they don’t give a shit about the NSA or any other government agency spying on them because they have nothing to hide, but they never seem to consider the larger picture…

I live in a country generally assumed to be a dictatorship. One of the Arab spring countries. I have lived through curfews and have seen the outcomes of the sort of surveillance now being revealed in the US. People here talking about curfews aren’t realizing what that actually FEELS like. It isn’t about having to go inside, and the practicality of that. It’s about creating the feeling that everyone, everything is watching. A few points:

1) the purpose of this surveillance from the governments point of view is to control enemies of the state. Not terrorists. People who are coalescing around ideas that would destabilize the status quo. These could be religious ideas. These could be groups like anon who are too good with tech for the governments liking. It makes it very easy to know who these people are. It also makes it very simple to control these people.

Lets say you are a college student and you get in with some people who want to stop farming practices that hurt animals. So you make a plan and go to protest these practices. You get there, and wow, the protest is huge. You never expected this, you were just goofing off. Well now everyone who was there is suspect. Even though you technically had the right to protest, you’re now considered a dangerous person.
Continue reading Food for thought

Making script logs clean

There are a lot of ways to clean up script logs either using macros in vim, sed one-liners or probably stand alone tools but I’ve found the easiest way is a simple function and alias within bash.

Add the following to your .bashrc file

source the .bashrc and now you can execute $ script_clean scriptlog.log and it will output scriptlog.log-processed so its nice and clean without all those pesky control characters.

Inspiration: http://www.commandlinefu.com/commands/view/2318/fix-a-typescript-file-created-by-the-script-program-to-remove-control-characters

bhistory, a tool for nobody

Previously I enabled Timestamps in Bash to allow me to know when someone was doing stupid things, such as deleting vixie-cron or truncating databases at midnight, now I have system that backups all of the .bash_history files on my production system and stores them so I can look for stupid behavior, however the logfiles are a little unfriendly to the human eye

example of logfiles go here

This necessitated the creation of a script that would let me view the history file as it was originally viewable with the history command and the timestamps parsed, thus bhistory was created.

Simple chmod the file, call it bhistory or whatever else you please and then drop it somewhere that your path statement covers and its time to view that logfile (and hopefully not find stupid things happening)

Usage: # bhistory /home/somebody/.bash_history

Naturally nobody should consider this a script that I support in any way, use this mess of code at your own discretion just make sure you have the timestamps enabled or not much is going to happen when you use it.

SSH Connection Script

Ever have a shitty environment where you have tons of devices that you need to connect to and don’t feel like typing out (and invariably mis-typing the hostname)?  Then this dirt simple script might be what you are looking for.

Just make sure the host file exists and has a hostname on each line rather than smashed together with some delimiter.  Its not elegant, has zero configuration but so far folks at work have found it somewhat handy to save some time, maybe you will too.

 

Home isn’t there anymore

Its kind of weird to move out of a place you have lived in for half a decade with the same people, same neighbors, same everything really. Unfortunately it couldn’t be avoided as the roommates have different directions to go now and the landlord wants to sell the property. So now I find myself staying with friends until my new place to live will be ready (its currently under construction now) and living as close to a nomad as I have in a long time. No lab equipment now, no comfortable place to sleep with the soothing sound of electronics humming along. I would be a lying shit if I didn’t admit that I feel more than a little lonely at the idea of no longer getting to see the people I lived with for years. Of course there were the promises to keep hanging out after going separate ways as friends always do when parting but the reality of things is that we are different people with different schedules who quite likely will never cross paths again once business with the now former landlord is concluded. Some have budding relationships leading them towards things like marriage and children, some have changing career paths to take them to new places.

Digital Wizard