Codestop

Jan 07

Extracting images from office files

A quick way to extract all the images in your 2007-2010 office files:

unzip -j "$filename" "**image*" -d "$basename"

Dec 06

Determining the operating system within Python

Use the os module in the standard library to determine the operating system in use:

if 'posix' in os.name:

or use uname() to get more information

if 'CYGWIN' in os.uname()[0]:

An update on using Windows Gvim with Cygwin

I was having issues with the last rendition of my gvim macro, here is the updated version:

function gvim()
{
    # allow for arguments to contain space
    OLD_IFS=$IFS
    IFS=$(echo -en "\n\b")
    args=
    command="gvim --servername CYGWIN"
    if [ -z "$@" ]; then 
        cmd /c $command
    else
    for i in "$@"; do
        # echo $i
        if [ -f "$i" ]; then
            # use shortname to fix spaces
            i=$(cygpath.exe -wsa "$i")
        fi
        args="$args $i"
    done
    # echo $command $args
    cmd /c $command $args
    fi
    IFS=$OLD_IFS

}

Nov 30

Extracting images from office files

A quick way to extract all the images in your 2007-2010 office files:

unzip -j "$filename" "**image*" -d "$basename"

Nov 09

Making symlinks work in both CYGWIN and windows

Lately, I have been symlinking almost everything in windows to the my cygwin home directory. However, when doing this, cygwin creates links that act as useless files in windows explorer.

Put the following command in your .bashrc file to fix the problem

export CYGWIN=”nodosfilewarning winsymlinks”

(Source: blog.zzamboni.org)

Nov 01

Dependencies for FVWM

I started building building the recent fvwm from source to make sure I get the changes Thomas Adam has been putting into the newest versions.

https://github.com/ThomasAdam/fvwm

The recent versions fix a lot of the EWMH issues I was having while using the xfce4-panel and other utilities.

Dependencies I have found necessary to build with all options enabled:

libsm-dev libice-dev libimlib2-dev x11proto-xinerama-dev libtiff-dev libpng12-dev libgif-dev libtool libxcursor-dev librsvg2-2.0-cil-dev libjpeg62-dev librplay3-dev libstroke0-dev libxpm-dev libtiff5 libreadline6-dev libncurses5-dev libxinerama-dev libltdl-dev libtiffxx5 libxt-dev

Oct 04

Move cygwin drives to /

First thing you should do when you install windows. It will allow you to access each drive by /c/Program\ Files/ instead of /cygdrive/c/Program\ Files/

mount --change-cygdrive-prefix /

Sep 17

Gvim function for cygwin

I got tired of having different implementations of GVIM for both windows and cygwin, so I created a gvim function in bash to enable me to launch the windows GVIM from within the bash shell, effectively opening any file with the windows gvim

function gvim()
{
	gvim_path=/cygdrive/c/Program\ Files/vim/vim72/gvim.exe
	if [ "$#" -lt 1 ] ; then
   run "`cygpath.exe -wa "$gvim_path"`"
   return;
   fi
   for file; do
	   run "`cygpath.exe -wa "$gvim_path"`" --servername CYGWIN --remote-tab-silent "`cygpath -wa $file`"
   done
}

Aug 12

One Thing Well: Ditch Your Display Manager -

If you’re the only person who uses your Linux computer, and you’re loyal to one window manager or Desktop Environment, there’s not much point in using a display manager to log in.

Instead, try adding the following to your ~/.bash_profile or ~/.zsh_profile:

if [[ -z "$DISPLAY" ]] && [[ $(tty)...

May 21

Remounting /system partition in Android

To remount the system partition in Android, first get root access and then type:

mount -o rw,remount /system