Browsing Category

System Administration

How to Add Multiple Elastic IP to EC2 in the AWS for Multiple SSL Certificates

There are a few concepts you should probably understand right off the bat. Firstly, Amazon Web Services only allows five public IP addresses to be associated with a single EC2 instance. This is not necessarily a punishing or truly restrictive move on their part. The truth is that if you are trying to attach more than five public IPs to a single EC2 instance, then you are probably doing something wrong.

ASP.NET C#

Mono not working on Apache Solution

While there are a myriad of reasons why your ASP.NET C# might not be working after a clean install in Linux, there is a very common problem that will prohibit Mono from working because of version 2.0 vs 4.0 issues. Typically this occurs on source code installations as opposed to package installs (particularly in CentOS / RHEL / Amazon Linux, not so much in Debian distributions).

You will see evidence of this crop up in your /var/log/httpd/error_log with an error message that looks like:

Cannot open assembly ‘/usr/lib/mono/2.0/mod-mono-server2.exe’: No such file or directory.

Fortunately there’s an easy fix.

List of Things to Check on Live Install of Linux for Laptops

This isn’t going to be a very long or in-depth article, just some thoughts that I’ve had about the subject in the past and a sort of general history about Linux installations on Laptops. I decided to initially put this down for a couple reasons, first and foremost because I use these articles for cataloguing what I’m up to, and notes to act as a reference for things I may check up on again in the future (thus why I post code snippets and mini-howtos on here for the most part).

A Nicer Custom FISH Shell Prompt

Over the past couple years Fish has really become my favorite go to shell. At the end of the day I think most people fall into either the bash, fish, or zsh shell camps. The truth is that while many of the zsh fans argue that any interesting feature eventually makes it into the shell, the honest truth is that all that extensibility actually works against it. Most definitely bash is fine for most things, but fish is clearly superior when it comes to just having an “out-of-the-box” experience. This especially includes the advanced type of completion it offers. Yes you can get anything you want in zsh, just keep it updated and modify it, but that just gets out of hand at times.

As for fish, it suffers from this problem as well when you “want to go off the reservation”. However, thankfully, that’s largely unnecessary for the basic “goodies”. However, one thing I do like is how you can basically “trade” functionality (under which aliases would fall into this category). The prompt for the shell is no different and so you can just copypasta this into a file and drop into your ~/.config/fish/functions/ directory.

Distorted or Skewed Screen During Linux Install from Grub

I came across a strange problem when recently installing Linux to an older Laptop model that I hadn’t seen in many, many years. While the installation media would boot up fine into the actual GRUB2 menu, any decision to install the Linux distribution (text or graphical) after that would result in the screen skewing/distorting itself in a way so that I could tell there was text or a window up on the screen, but I couldn’t really see much more than that, with the resolution appearing to be out of control and everything shifted at a severe slant.

Recursive Global Search and Replace in Linux

I was working on a very old project of mine, a MUD called DooMMUD (based off of the popular id Software series of games) and just for shits n giggles, I thought I would move the codebase over to something newer and more stable like the Circle-based tbaMUD codebase just to see if I could get it up and running again.

At some point I needed to change some Variables and Classes (structs really) over the entire codebase (e.g. coins to credits)

No way was I going to bother editing all the files (if I could even find them all), I would almost definitely miss something.

So I used a combination of grep and xargs & sed to recursively go through every directory in the tbaMUD structure and replace every string or replace every phrase that I needed changed.

Behold the majesty of my one line command:

grep -rl matchstring somedir/ | xargs sed -i 's/string1/string2/g'

We pipe the recursive results from grep into xargs & sed which takes those results and run a global search and replace within each instance of string1 with string2.

Huzzah!

I remember when I was 8 years old, my father had made me an account on his Sun Microsystem Workstation 3/80 running some later version of SunOS. I used KornShell over a matter of person preference (I don’t think BASH was even around back then) and every day I would look into /usr/bin or /bin to look for new command, run man page on it and tinker around with it.

My father said it best when he said “Its like having a Christmas Present every single day”. The man was right.

Manipulating 0 byte or empty files in Linux

There are a surprising amount of times I’ve had to manipulate empty files dispersed amongst a large group of variously sized other files.

A long time ago I remember using some convoluted shell script on my Sun Workstation 3/80 (SunOS baby, none of that fancy Solaris whippersnapper!)

Later when I was using Debian, I wrote little TCL (and even later Python) scripts.

Now I’m using Ubuntu on most of my Desktop (or development I s’pose) machines and it seems things just keep getting easier.

Now I found a method that borders on the rediculous easy, using the find command.


find . -type f -size 0 | xargs command

So lets say we just want to list the files MMmkay?


find . -type f -size 0 | xargs ls -l

Or say we want to remove/delete the files


find . -type f -size 0 | xargs rm -f

Of course I know that this isn’t an Ubuntu specific solution (this should obviously work even on older versions of find and pick-your-unix-flavor or even some inferior operating system (*cough*) where you’ve ported over your unix tools to.