Skip to content

Instantly share code, notes, and snippets.

View jnbek's full-sized avatar

John D Jones III jnbek

View GitHub Profile
@jnbek
jnbek / xvfb-cutycapt.pl
Created December 20, 2010 01:25
My Perl Wrapper for Xvfb and CutyCapt
#!/usr/bin/perl -w
use strict;
use warnings;
use Getopt::Long;
use vars qw($url $out);
my $HOME = $ENV{'HOME'};
my $opt = GetOptions("url=s" => \$url,
"out=s" => \$out,
);
print "Preparing to thumbnail $url to $out\n";
@jnbek
jnbek / CutyCapt-jail.sh
Created December 20, 2010 01:28
Speedy Install for CutyCapt in a FreeBSD jail
echo "nameserver 192.168.0.1" > /etc/resolv.conf
mkdir ~/bin
mkdir ~/build
cd ~/build
pkg_add -r bash portupgrade vim-lite xorg-vfbserver jpeg qt4-imageformats qt4-qmake qt4-moc qt4-webkit qt4-svg subversion xkeyboard-config xkbcomp
chsh -s /usr/local/bin/bash root
/usr/local/bin/svn co --trust-server-cert --non-interactive https://cutycapt.svn.sourceforge.net/svnroot/cutycapt
cd cutycapt/CutyCapt
/usr/local/bin/qmake-qt4
make
@jnbek
jnbek / openpipes
Created December 20, 2010 02:01
Working example with using open and pipes for external program execution.
perl -e'open my $PROG, "-|", "ls -hal"; while (<$PROG>) { print $_; } close $PROG;'
@jnbek
jnbek / build_gtk.pl
Created April 3, 2011 18:05
This is 'supposed' to build Gtk2-Perl on Strawberry Perl
#!/usr/bin/perl --
# Stolen from http://perlmonks.com/?node_id=793472
# Install WWW:Mechanize and GnuWin32 http://getgnuwin32.sourceforge.net/
$VERSION = '0.0104';
use strict;
use warnings;
my @gtk_bundle;
my @tarball;
@jnbek
jnbek / kjv.cpp
Created April 11, 2011 19:48
An old, VERY OLD, king james version bible db query program I wrote some time when Moses was in diapers.
#include <iostream>
#include <cgicc/Cgicc.h>
#include <cgicc/HTTPHTMLHeader.h>
#include <cgicc/HTMLClasses.h>
// mysql must come after cgi stuff for some reason
#include <mysql++.h>
using namespace mysqlpp;
using namespace cgicc;
@jnbek
jnbek / insert_after.js
Created April 26, 2011 15:09
Insert After for use with Uploads
function insertAfter(newElement,targetElement) {
//target is what you want it to go after. Look for this elements parent.
var parent = targetElement.parentNode;
//if the parents lastchild is the targetElement...
if(parent.lastchild == targetElement) {
//add the newElement after the target element.
parent.appendChild(newElement);
} else {
// else the target has siblings, insert the new element between the target and it's next sibling.
@jnbek
jnbek / slurp.pl
Created April 26, 2011 15:13
CGI::Ex Upload File Slurpings
my $file = $self->{'form'}->{'upload_name'};
my $contents = do { local (@ARGV, $/) = $file; <> };
@jnbek
jnbek / gtk-browser.pl
Created May 4, 2011 16:29
Mini Webkit browser in Perl GTK
#!/usr/bin/perl -w
use strict;
use warnings;
use Gtk2 -init;
use Gtk2::WebKit;
my $url = 'http://google.com';
my $window = Gtk2::Window->new;
$window->set_default_size(320,160);
$window->signal_connect(destroy => sub { Gtk2->main_quit });
@jnbek
jnbek / gtkrc-3.0
Created May 8, 2011 18:50
my gtkrc-3.0
/*
* this file is part of the oxygen gtk engine
* Copyright (c) 2010 Hugo Pereira Da Costa <hugo@oxygen-icons.org>
* Copyright (c) 2010 Ruslan Kabatsayev <b7.10110111@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or( at your option ) any later version.
*
@jnbek
jnbek / aplog.pl
Created May 18, 2011 19:58
Apache Log Parser
#!/usr/bin/perl -w
use strict;
use Getopt::Std;
open (LOG, "/var/log/httpd/adp-gmbh/xlf_log");
my $options = {};
# n how many urls?