Wednesday, November 6, 2013

HTTParty SSL set verify_none

Friend of mine had an issue with setting SSL self.verify_mode = OpenSSL::SSL::VERIFY_NONE. This was the default for a while back in the 0.9 days. It seems there was a bit of a change in how this is done. The code that handles verify_mode for HTTParty is here. The solution is to set it per-request, like this:

self.get("/something", :verify => false)

Just wanted to make a note of this since it doesn't seem to be on Google anywhere.

Saturday, May 1, 2010

Holy God! They're Bug Sweeping

And there it was:

var FirebugUtils={

consoleMethods: ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"],

available: function() {
return false;
},
init: function() {
if (!this.available()) {
this.disable();
}
},
disable: function() {

if(!window.console){
window.console = {};
var methods = this.consoleMethods;
for (var i=methods.length-1; i > -1; i--) {
window.console[methods[i]] = function(){};
}
}
}
};

FirebugUtils.init();
They're disabling FireBug, or at least trying. I found this little gem on Britainica.com. What a bunch of assholes. Now I must decide.
  1. If it works.
  2. How best to break it.
Fun stuff.

Monday, April 20, 2009

Creating a VCD on Windows with free software!

Creating a VCD for free is a labor intensive process. There are countless products which cost money that claim to be "FREE" and in fact, are not. It's a minefield. Anyway, there are various ways of creating VCDs for free, this is the easiest I can find.

First convert the file to mpeg1 VCD compatible with SUPER:
http://www.erightsoft.biz/GetFile.php?SUPERsetup.exe

Then package the mpeg you just created into a VCD format you can burn to disc (.bin and .cue files) with VCDImagerGUI:
http://download2.videohelp.com/download/VCDImagerGUI.zip

Then burn the VCD (in the .bin and .cue files) to disc using ImgBurn:
http://download.betanews.com/download/1128426215-1/SetupImgBurn_2.4.4.0.exe

Works great.

Wednesday, January 21, 2009

Install Camfrog Server on Ubuntu Linux 8.10

Camfrog doesn't offer a Ubuntu version of their product, so here's a guide in getting it to work for Ubuntu 8.10.


  1. Download the RPM here: http://download.camfrog.com/serverlinux.phtml

  2. Install alien: sudo apt-get install alien

  3. Install libstdc++.so.6: apt-get install lib32stdc++6

  4. Change directory to the file you downloaded from CamFrog and type: alien camfrog_x.xx.rpm

  5. Now install the .deb package: dpkg -i camfrogserver_4.2-2_all.deb

  6. Now just configure according to the instructions in the manual: man camfrogserver.conf

  7. You may want to delete /etc/rc.d/init.d/camfrogserver since it won't work under Ubuntu.

Wednesday, December 24, 2008

Rename list of tv episodes

This is a great ruby script for renaming TV episodes. It's based on the Wikipedia tv episode listing format, which looks like this:

== Season 1: 2003 ==
{| class="wikitable" style="width:98%;"
|-
! width="20"| # !! width="250"|Title !! Patient Portrayer(s) !! Surgery Music !! width="120" | Original airdate !! width="80" | Production code

{{Episode list
|LineColor=AA0004
|Title=Pilot
|OriginalAirDate=July 22, 2003
|Aux1=[[Geoffrey Rivas]]
|Aux2=[[Paint It Black]]—[[The Rolling Stones]]
|ProdCode=101
|EpisodeNumber=1
|ShortSummary=[[Christian Troy|Christian]]'s unethical acceptance of $300,000 from a mobster desperate for a new face put his partnership with [[Sean McNamara|Sean]] in jeopardy and their lives in peril.
|LineColor=AA0004
}}

This happens to be the listing for the first episode of the first season of Nip/Tuck. Anyway, all you need to do to rename all your episodes from a format like "Show Name s(Season Number)e(Episode Number).avi" to "Season (Number) Episode (Number) - Episode Title.avi" is run this script. First you need to look up the Wikipedia episode listing, then click the "Edit" button at the top of the table. Then save all the text in the editor to a file called "episodes.txt" in the same directory as the video files.

#!/usr/bin/ruby



title = ''

ep    = ''

eps   = Hash.new



File.open("episodes.txt").each do |l|

    if l.match(/Title=/)

        title = l.slice(l.index('=')+1, l.length).chop

    end

    if l.match(/ProdCode/)

        ep    = l.slice(l.index('=')+1, l.length).chop

        eps[ep] = title

    end

end



Dir.open('.').each do |f|

    next unless f.match(/\.avi$/)

    if f.match(/s(\d+)e(\d+)/i)

        key = $1.to_i.to_s + $2

        newf = "Season 5 Episode #{$2} - #{eps[key]}.avi"

        File.rename(f, newf)

    else

        puts "No match: #{f}"

    end

end

Yes, it's short, but I've found myself rewriting it countless times in several languages. It is highly useful.

Saturday, November 8, 2008

Building xlslib on MSYS

I was looking for a way to create Excel spreadsheets without needing to resort to Perl's fantastic Spreadsheet::WriteExcel. I wanted something fast and light, so I went out looking and found the library xlslib. This appeared perfect, unfortunately no win32 DLL was available. This is the process to create one.

Follow the installation process for MSYS and MinGW. Install all recommended updates, it will not work otherwise. Install the latest version of libtool(Otherwise the make will fail since it can't find C:/msys/1.0/local/lib/libxls.0.dylib. This is because the old libtool does not know about dll as an alternative extension for dynamic libraries (.dylib is the default for MacOS X.))

Download xlslib and untar it to your MSYS home directory (usually in C:/msys/1.0/home/yourusername. Double click the MSYS icon to open a new session and do the following.

1. Add the following line to the top of the file in ~/xlslib/src/oledoc/oledoc.cpp.
#define bzero(b,len) (memset((b), '\0', (len)), (void) 0)
2. Run the following commands.

~$ cd ~/xlslib
~/xlslib$ autoheader
~/xlslib$ touch AUTHORS ChangeLog stamp-h
~/xlslib$ aclocal
~/xlslib$ autoconf
~/xlslib$ touch config/ltmain.sh
~/xlslib$ automake
~/xlslib$ rm config/ltmain.sh
~/xlslib$ ./configure
~/xlslib$ make

3. The make will fail while building targets/test/mainC.c.

4. It will also fail to create a dll file. This can be remedied by running the following commands.

5. First modify libtool in ~/xlslib and change the line that says:
*cygwin*|*msys*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;

to
*cygwin*|*msys*) output=`$echo $output` ;;


6. This keeps libtool from adding .exe to the end of the .dll file. Then run the following commands.

~/xlslib$ cd src
~/xlslib/src$ /bin/sh ../libtool --tag=CXX --mode=link g++ -g -O2 -shared -o xlslib.dll -rpath /usr/local/lib overnew.lo blank.lo cbridge.lo cell.lo colinfo.lo continue.lo crc.lo datast.lo docsumminfo.lo extformat.lo font.lo format.lo globalrec.lo index.lo label.lo merged.lo number.lo range.lo recdef.lo record.lo row.lo sheetrec.lo summinfo.lo unit.lo workbook.lo binfile.lo oledoc.lo olefs.lo oleprop.lo
~/xlslib/src$ strip -g xlslib.dll # (Optional) Strip debugging symbols.

5. You now have a working xlslib.dll!

Friday, August 1, 2008

GMail for Symbian s60 Is Crippled

The GMail application for s60 seems to be crippled. Actually, the m.gmail.com website is affected too. How, you ask? Well, have you tried downloading a zip file to your mobile from the GMail application? No? Well, if you do, all you get is a plain text listing of the zip file contents. There does not appear to be any way to download the actual zip file. Worse, if you own a phone with a decent web browser and go to m.gmail.com and try - all you get is a notification "1 attachment." Lovely.

The solution was to turn on IMAP and then setup IMAP in the Nokia Messaging application. This finally allowed me to download the stinking zip file. Hurrah. I'm just glad I have a phone that has this feature.

The attachment I was trying to download was the highly sweet game Lament Island. I bought it on a friend's PC and didn't want to install the Nokia phone manager software (not to mention that I didn't have my data cable.) This isn't all that unusual. What if I had a colleague send me a PowerPoint for a presentation I was giving? I would be totally SOL, if it wasn't for IMAP.