Monday, February 20, 2012

a silly little script to calculate the differences between time

feed it a string from date using the format at the bottom of the script


#!/usr/bin/python

import sys
import datetime

class timediff:
  strarg=""
  def __init__(self, args=sys.argv[1:]):
    print 'time is now: ', datetime.datetime.utcnow()
    print 'your input was: ',args
    self.strarg=args


  def toDT(self, thenstr):
    strpformat="%Y,%m,%d,%H,%M,%S"
    try:
      return datetime.datetime.strptime(thenstr, strpformat)
    except:
      print "there is something wrong with your input, did you use format like: ", strpformat
      sys.exit(-1)

  def thennow(self, then, now=datetime.datetime.now() ):
    timediff = (now - then)
    minutes = timediff.days*1440 + timediff.seconds/60
    return minutes
  # print number of minutes between then and .now()
#  date +%Y,%m,%d,%H,%M,%S

Wednesday, February 8, 2012

settings ups of the vim editor for javascript development

So I've been following the tutorial here: http://arturadib.com/hello-backbonejs/docs/5.html
and I realized that my vim settings just weren't cutting it for the indentation in JS.

I found this blog: http://www.brankovukelic.com/post/2091037293/turn-vim-into-powerful-javascript-editor and followed the directions to install git://github.com/pangloss/vim-javascript.git

After using hardlinks to install the pertinent files (he uses ruby's rake instead of sh) and also using jsbeautify, it seems to be working nicely.

Here's a link to my current config: www.blackdotcompany.com/vim-js-conf.tgz

Tuesday, February 7, 2012

well that was interesting

Well basically I was having a very very annoying and very reproducible error with SSH and MAC packet corruption (Not the HWADDR MAC, but the SSH-TCP specific checksum).

I couldn't figure it out at all.

There was another problem as well -- on many websites, firefox would crash like nobody's business. Very reproducible on flickr and youtube. I even built firefox in debug mode and turned on gdb and couldn't figure it out!

It was getting so annoying I just installed Mint. See ya later Debian/Wheezy. Get your shit together.