Thursday, February 16, 2017

Install psycopg2 on a Greenplum system

If you try to install psycopg2 on a Greenplum system using pip you may run into this error:

...
Error: pg_config executable not found.  
    Please add the directory containing pg_config to the PATH
    or specify the full executable path with the option:
        python setup.py build_ext --pg-config /path/to/pg_config build ...
    or with the pg_config option in 'setup.cfg'.
...

The solution is to add the path to the Greenplum bin directory to your environment PATH.

export PATH=$PATH:/path/to/greenplum-db/bin/

Then run pip install psycopg2 and all should be good.

Monday, January 9, 2017

Google Fiber remote lag

The lag in my Google Fiber remote was driving me crazy. Figured out how to disable bluetooth & go back to IR only on the remote. Lag problem solved.

Sunday, October 9, 2016

Show file in git at specific commit

I wanted to double check what a script looked like two commits ago.

git log path/to/file

Get the commit number from the version I want to see, get the first 4 to 6 characters.

git show commit#:path/to/file

Credit goes here

Tuesday, May 31, 2016

List of PIDs only

I wanted a list of pids only so I could run them through a while loop for processing. To get just a list of pids on Linux I used:

ps --no-headers -o pid -C processname

Thursday, April 14, 2016

Get filename without path, filename without extension, extension of filename in Bash

SOURCE

Get filename without path
basefilename=$(basename /full/path/to/file.txt)

Get filename without extension
filewoext="${basefilename%.*}"

Get extension of file
fileext="${basefilename##*.}"

Friday, April 1, 2016

Arrays in Bash

#!/usr/bin/env bash

# Create the array
myarray=()

# Add items to the array
# Add a sequence of numbers from 1 to 16
#for item in {0..16}
cd ~/Documents/

# Add a list of files to the array
# List all *.txt files in the ~/Documents directory and grab the three oldest
# To grab the 3 most recent files use ls -rt. Order by time in reverse with most recent listed last
for item in $(ls -t *.txt | tail -3)
do
  myarray+=("${item}")
done

# Iterate over the array and print out items
for item in ${myarray[@]}
do
  printf "Item: ${item}\n"
done

# Print out the number of elements in the array

printf "${#myarray[@]}\n"

Friday, March 25, 2016

Fedora 23 netinstall URL

Not sure why I found this so challenging, maybe because I haven't done a netinstall in ages. Anyway, finally figured out how to setup the Installation Source

your selected mirror/path/to/installation/end with os/

So for me it was:

http://fedora.mirrors.tds.net/fedora/releases/23/Server/x86_64/os/

Key was to end it with os/.