Archive for September, 2007

To Split MP3 files using Silence

Posted in Solaris, Uncategorized on September 20, 2007 by aghoras

To split an mp3 into 5 minute segments:

mp3splt -t 5.0 file.mp3

To tag all the created segments with info:

n=0;
for i in *.mp3;
do let n=$n+1;
mp3info -a “Sir Arthur Conan Doyle” -l “The Adv. of Sherlock Holmes I” -t “Sherlock Holmes Part I ($n)” -g 12 $i;
echo $i;
done

Cygwin Pretty Print

Posted in Uncategorized on September 17, 2007 by aghoras

Here’s a quick script to convert a file to pretty print PDF in Cygwin

#!/bin/bash
a2ps -r -M letterdj -o - $1 | ps2pdf - $1.pdf

Posted in Uncategorized on September 17, 2007 by aghoras

“I guess I should warn you, if I turn out to be particularly clear, you’ve probably misunderstood what I’ve said”

Alan Greenspan quote

VB Hex Function used for Bit Decoding in Excel

Posted in Programming on September 12, 2007 by aghoras
Attribute VB_Name = "HexFunctions"
' Returns the a bit range in a given hex
Function Bits(HexNum As String, startBit As Integer, endBit As Integer) As String
    Dim num, mask, startDivider, Results As Long

    num = CLng("&H" & HexNum)
    mask = 0

    ' play this silly trick to avoid overflows when doing things with 2^31
    If endBit = 31 Then
        endBit = 30
        OrVal = &H80000000
    Else
        OrVal = 0
    End If

    'create the mask 1s
    For i = startBit To endBit
        mask = mask Or (2 ^ i)
    Next

    mask = mask Or OrVal

    Test = Hex(mask)

    Results = (num And mask)
    Test = Hex(Results)
    ' shift to the right
    For i = 1 To startBit
        ' overcome the stupid sign extension
        Results = Results \\ 2
        If (Results < 0) Then
            Results = Results And &H7FFFFFFF
        End If
        Test = Hex(Results)
    Next

    Bits = Hex(Results)
End Function
' Pads the given hex number with leading zeros
Function PadZeros(HexNum As String, size As Integer) As String
    Results = HexNum
    For i = 1 To size - Len(HexNum)
        Results = "0" + Results
    Next

    PadZeros = Results
End Function

'Converts a hex number to long
Function HexToDecimal(HexNum As String) As Long
    HexToDecimal = CLng("&H" & HexNum)
End Function

'Converts Decimal To Hex
Function DecimalToHex(num As Long) As String
    DecimalToHex = Hex(num)
End Function

Flying Song List

Posted in Flying on September 7, 2007 by aghoras

Here’s a list of songs I like to listen to when I go flying:

  1. King Of The Road – Roger Miller
  2. Tree Top Flyer – Stephen Stills
  3. Get Off My Cloud – The Stones
  4. Honky Tonk Women – The Stones
  5. Miss You – The Stones
  6. Vincent- Don McClean
  7. Brandenburg Concerto No. 5 – Allegro – Bach
  8. Just the Two of Us – Bill Withers
  9. Border Song – Elton John
  10. The Sound of Silence – Simon and Garfunkel
  11. When the Levee Breaks – Led Zeppelin
  12. Stairway to Haven – Led Zeppelin
  13. Closer to You – J.J. Cale
  14. Requiem (First 8 parts) – Mozart
  15. Chitlins Con Carne – SRV