Posts

Bash functions to simply finding instance IPs when using AWS CLI

We have both EC2 and VPC nodes. Sometimes it is convenient to run bash commands without having to copy and paste the values from the WebUI. Here are a couple of bash functions to do that: function i2ip () {   local NAME="$1"   local IP   for IP in `ec2-describe-instances --filter instance-state-name=running --filter instance-id=${NAME:?MISSING_VALUE} | grep ^INSTANCE | awk '{ if ( $4 ~ /^ec2/ ) print $4; else print $12; }'` ; do   echo ${IP}   done } function n2ip () {   local NAME="$1"   local IP   for IP in `ec2-describe-instances --filter instance-state-name=running --filter tag:Name=${NAME:?MISSING_VALUE} | grep ^INSTANCE | awk '{ if ( $4 ~ /^ec2/ ) print $4; else print $12; }'` ; do   echo ${IP}   done } you might do something like this: rsync -av --progress logstash $(n2ip rpmbuild-node):/tmp/. where "rpmbuild-node" was the value of a tag "Name" on the instance. I decided to return all of the values so I could handle t...

YAML Syntax Highlighting in gedit

Reference URLS: http://blog.dentcat.com/2009/09/highlighting-yaml-in-gedit_02.html http://codesauce.com/posts/gedit3-yaml-syntax-highlighting/ http://superuser.com/questions/353391/custom-gedit-syntax-highlighting-for-dummies sudo yum install subversion cd /tmp && svn checkout http://masood.googlecode.com/svn/trunk/yaml-language-spec/ cd yaml-language-spec/ sudo cp yaml.lang /usr/share/gtksourceview-3.0/language-specs/ sudo chmod 644 /usr/share/gtksourceview-3.0/language-specs/yaml.lang

The importance of /var/lock/subsys

I was experimenting with shutdown scripts today when I discovered the importance of the /var/lock/subsys  directory. I didn't realize that there was code in /etc/rc that checked for the existence of a lock file before trying to stop a service.  I guess I never had need to really look at this before.  I banged my head repeated only why the K* scripts I had created weren't working.  Until I finally looked at /etc/rc and realized it was only executing K* scripts for services that had touch /var/lock/subsys/<SERVICENAME>. Duh, should have looked there first.

Fedora 17 on Dell 530s

yum -y update (umask 022; sudo http_proxy=http://proxy:3128 ftp_proxy=http://proxy:3128 yum install yum-plugin-fastestmirror yum-plugin-{downloadonly,keys,priorities,remove-with-leaves,show-leaves,verify} nedit rxvt-unicode-256color xscreensaver\* xorg\*font\*Type1 xorg\*font\*misc screen dump rxvt rxvt-unicode-256color) yum groupinstall LXDE yum install kernel-devel gcc bison vi /etc/yum.repos.d/google-chrome.repo [google-chrome] name=google-chrome baseurl=http://dl.google.com/linux/chrome/rpm/stable/x86_64 enabled=1 gpgcheck=1 gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub chmod 644  /etc/yum.repos.d/google-chrome.repo chown root:root  /etc/yum.repos.d/google-chrome.repo yum install google-chrome-stable sudoedit /etc/default/grub # s/rhgb quiet/verbose/ sudo grub2-mkconfig -o /boot/grub2/grub.cfg (umask 022; sudo yum -y groupinstall "Development Tools" "Development Libraries") Installing virtualbox curl http://d...

Fixing microsoft encoding weirdness

Common problem:  Team members use Microsoft for editing.  Microsoft editors do weird things to text files (no eol, etc)  Need to fix in a perforce project but don't want to have to do a lot of manual work. First, create a script file to give perforce for the editor command: > cat urxvt-perforce #!/bin/bash urxvt -geometry 240x80 -e vim $* Next, update perforce, then add the problem files to a change list (make sure that you don't include binary files in the list).  Open the files using the script. Once in vim, use the doargs command to make life nice (reference:  http://vim.wikia.com/wiki/File_format#cite_note-4 ): :argdo set ff=unix|update :argdo set ff=unix|w diff against have revision and IFF good, submit.

Google Chrome Modifications

I like to use the "High Contrast" Chrome plugin to reverse web browsing colors.  I have noticed that the visited and non-visited colors are very hard to distinguish in reverse color mode. After some googling I found that this can be controlled by editting: .config/google-chrome/Default/User StyleSheets/Custom.css and adding: a:visited {color: orange !important;}

Borderlands 2 on Fedora - Dell Studio XPS 16

The default driver for the Radeon HD 4670 card in my laptop is the Xorg Radeon driver.   Radeon support is rather hit or miss thanks to ATI/AMD. I installed Fedora 17 x86_64, updated everything, installed wine (and all the associated i686 associated files.)  I then installed a Trial version of Codeweaver's crossover (crossover-11.2.1-1.i386.rpm).  After installing Steam in its own bottle (XP), and then downloading and running Borderlands 2 (actually you have to copy Borderlands2.exe over Launcher.exe to work around an annoying dotNet think) I would get weird error: Your video card does not support alpha blending with floating point render targets (D3DFMT_A16B16G16R16F), which is required to run this game. Exitting... which it turns out was due to the apparent patent restrictions on the algorithm and since Fedora is based in the US, the mesa libs are compiled without that. Still wanting to see if I could get this to work I googled around and discovered that I cou...