Archive for the ‘Uncategorized’ Category.

My blog has moved.

Hello Archers !

I’ve moved my personal blog to https://crouse.us/ ……. so visit me there if you want to see what I’m up too :) But never fear, I’ll be maintaining this site as well. My current project: https://crouse.us/?p=127

test 3

try:
    from OpenSSL import SSL
except ImportError:
    SSL = None

TEST

try:
    from OpenSSL import SSL
except ImportError:
    SSL = None

VIM: Auto Indenting php/html files.

This is pretty easy...but a handy tip none the less.

VIM: AutoIndent php/html files.
:set ft=phtml
gg=G

 

Getting colors to work for ls and vim on Solaris 11

Just some quick notes, for myself and in case someone else ever wants this. In this day and age, I hate having to setup color on terminals ….colors make things very easy to see, quickly. So here are my notes so i don’t have to go spend time figuring it out yet again lol.

in your .profile or .bashrc
export TERM=xtermc
alias ls=”/usr/gnu/bin/ls -lah –color=auto”

in your .vimrc
syntax on
set showmatch
set bg=dark
set incsearch
set tabstop=4
set shiftwidth=4
set expandtab
set bs=2

bs=2 makes your backspace erase instead of inserting weird chars
syntax=on will enable color
the rest of it is just my personal settins in vim :)

My vmware workstation Archlinux Desktop

Host OS is Windows 7, running vmware workstation, and i’m 99% of the time in my ArchLinux virtual machine … and I love it.

Anyway, here is a screenshot of my current desktop, xfce4.

Archlinux – fixing vmware errors in log

 

 

When using open-vmware-tools, I was having the following errors reported every 30 seconds.
Below is how I fixed it.

[root@ArchLinux vmware-tools]# tail -f /var/log/messages.log
Sep 28 13:18:46 localhost vmsvc[696]: [ warning] [vmsvc] HostinfoOSData: Error: no distro file found
Sep 28 13:18:46 localhost vmsvc[696]: [ warning] [guestinfo] Failed to get OS info.
Sep 28 13:19:16 localhost vmsvc[696]: [ warning] [vmsvc] HostinfoReadDistroFile: Cannot work with empty file.
Sep 28 13:19:16 localhost vmsvc[696]: [ warning] [vmsvc] HostinfoReadDistroFile: Cannot work with empty file.
Sep 28 13:19:16 localhost vmsvc[696]: [ warning] [vmsvc] HostinfoOSData: Error: no distro file found
Sep 28 13:19:16 localhost vmsvc[696]: [ warning] [guestinfo] Failed to get OS info.
Sep 28 13:19:16 localhost vmsvc[696]: [ warning] [vmsvc] HostinfoReadDistroFile: Cannot work with empty file.
Sep 28 13:19:16 localhost vmsvc[696]: [ warning] [vmsvc] HostinfoReadDistroFile: Cannot work with empty file.
Sep 28 13:19:16 localhost vmsvc[696]: [ warning] [vmsvc] HostinfoOSData: Error: no distro file found
Sep 28 13:19:16 localhost vmsvc[696]: [ warning] [guestinfo] Failed to get OS info.

I simply put the following into a file located at:  /etc/release

ArchLinux Kernel 3.x

That stopped the error messages from showing up in /var/log/message.log

Using “cut” to remove extra data.

At work we have to use Windows … so I’m stuck using mirc, and sometimes when pasting code back and forth, we want to quickly remove the extra data from the front when cutting text/data from the mirc window. It usually has a timestamp and name that need to be removed.
This does the trick quickly. You have to love the simplicity of shell commands. The “cut” command has some nice options that rarely get used, one is to list everything from field X on.. in this example start at the third field and list the rest is shown by “-f 3-”.
#!/usr/bin/bash
# stripmirc – strips fields from mirc copy/paste
# crouse

export TERM=xtermc
timestamp=`date +%T`
tempfile=”/tmp/mirc.$timestamp.tempfile”
touch ${tempfile}

# TRAP for the cleanup routine in case bad stuff happens.
trap cleanup 1 2 3 6
# Function for deleting files not needed.
cleanup ()
{
rm ${tempfile}
}

echo “Type CTRL D to end”
cat > ${tempfile}
echo “”;echo “”;echo “”;
cat ${tempfile} | cut -d” ” -f 3-
rm ${tempfile}
exit 0