Skip to content

Instantly share code, notes, and snippets.

View pmorch's full-sized avatar

Peter Valdemar Mørch pmorch

View GitHub Profile
@pmorch
pmorch / createTables.sql
Created September 7, 2011 12:03
A large mysql dump for illustrating index problems
CREATE TABLE `IDs` (
`ID` int(11) NOT NULL default '0',
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `cfgMonitoredTableRows` (
`ID` int(11) NOT NULL,
`nodeID` int(11) NOT NULL default '0',
`monitoredTableID` int(11) NOT NULL default '0',
PRIMARY KEY (`ID`),
KEY `nodeTable` (`nodeID`,`monitoredTableID`),
@pmorch
pmorch / workaround.pl
Last active September 27, 2015 04:18
Workaround for SNMP::Session->new(DestHost=>"bogus") printing to STDERR
my $sess;
my ($tempSTDERR, $STDERRfilename) = File::Temp::tempfile();
open SAVE_STDERR, '>&STDERR';
open STDERR, '>&' . fileno($tempSTDERR);
# If SNMP::Session->new() is going to die for whatever reason, make sure we
# restore STDERR first!
eval {
@pmorch
pmorch / README.md
Created October 12, 2011 10:46
Error running make docs in peg-markdown

When I then run make docs, I get an error: LaTeX Error: Cannot determine size of graphic in TextMate-prefs.png (no BoundingBox)

Am I doing something wrong?

To get started, I cloned peg-multimarkdown, ran update_submodules.sh and put LaTeX Support Files in their place at ~/texmf/tex/mmd/. (Can I (please) put them somewhere relative to ./ and set a flag or environment variable, so I don't mess with ~?)

@pmorch
pmorch / README.md
Created October 17, 2011 20:29
Net-SNMP perl interface problem when retry after initial noSuchName

This is supporting formation for this sourceforget bug report:

SNMP Version 1: If I try to SNMP get two OIDs:

  • one of which doesn't exist
  • the other being in numerical .1.3.6.1.4.1.123456.1 format

like this:

@pmorch
pmorch / README.md
Created October 18, 2011 06:45
hptelnet.escape: A log of the output of a telnet session to a piece of HP network equipment

This a log of the output of telnet-ing to a piece of HP network equipment.

In How to display ANSI Escape codes e.g. from tshark telnet trace? I ask how one views this output in a meaningful way. No answers yet ;-)

I also notice, that if I:

> cat hptelnet.escape

My Linux gnome-terminal or xterm gets smashed in a simlar way. Type a very long command (more than one line, and see that the second line doesn't wrap down to the next line, but "stays in the current line". Which makes it impossible to edit prior commands or use the terminal for anything longer than one line. reset doesn't work. I have to close the terminal and start a new one. :-(

@pmorch
pmorch / README.md
Created November 15, 2011 08:37
Ubuntu kernel config files for problem with pppd
@pmorch
pmorch / gist:1610432
Created January 14, 2012 05:27
"Mysterious" error ajax callback on window unload
<!DOCTYPE html>
<!--
This requires console.log, so try it in e.g. firefox or chrome and look at
output in the console
-->
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
@pmorch
pmorch / HelloWorld.class
Created January 16, 2012 15:11
OpenJDK goes 100%
@pmorch
pmorch / README.md
Created February 1, 2012 08:17
Working bugfix for "ThemeRoller Bookmarklet not working" http://bugs.jqueryui.com/ticket/7195
@pmorch
pmorch / unexpectedDestroySequence.pl
Created July 11, 2012 07:03
perl: DESTROY called in unexpected sequence
#!/usr/bin/perl
use strict;
use warnings;
=head1 DESTROY called in unexpected sequence
See http://stackoverflow.com/questions/11427281/destroy-called-in-unexpected-sequence
for discussion.
I started out noticing something odd about "Scope::Guard". If I undef