Skip to content

Instantly share code, notes, and snippets.

View alicraigmile's full-sized avatar

Ali Craigmile alicraigmile

View GitHub Profile
@alicraigmile
alicraigmile / netgear-dg834gt-dyndns.txt
Last active December 10, 2015 02:19
EasyDNS based dynamic dns update on a Netgear dg834gt router.
Research:
* http://www.darryl.cain.com.au/dg834gt.php
* http://linux.die.net/man/8/ez-ipupdate
To enable debugging mode on your Netgear DG834GT:
http://192.168.0.1/setup.cgi?todo=debug
Then telnet to 192.168.0.1 and type:
@alicraigmile
alicraigmile / xpaths1.xsl
Created July 23, 2013 13:37
XSL to get all XPaths in a document
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="//*[not(*)]">
<xsl:for-each select="ancestor-or-self::*">
<xsl:text>/</xsl:text>
<xsl:value-of select="local-name()"/>
</xsl:for-each>
@alicraigmile
alicraigmile / xpath2.xsl
Created July 23, 2013 14:02
Get all unique elements in a document
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml"/>
<xsl:key name="elements" match="*" use="name()"/>
<xsl:template match="/">
<xsl:for-each select="//*[generate-id(.)=generate-id(key('elements',name())[1])]">
<xsl:sort select="name()"/>
<xsl:for-each select="key('elements', name())">
<xsl:if test="position()=1">
<xsl:element name="element">
#!/usr/bin/perl
use strict;
use Image::Magick;
my $image = Image::Magick->new;
$image->Set(size=>'300x300');
#$image->ReadImage('xc:white');
#$image->Set('pixel[49,49]'=>'red');
@alicraigmile
alicraigmile / mp.pl
Created October 28, 2013 23:13
An old sample of code showing how to play MP3s on a windows machine in perl (god only knows why I wanted to).
use Win32::MediaPlayer;
my $winmm = new Win32::MediaPlayer; # new an object
$winmm->load('d:/10.mp3'); # Load music file disk, or an URL
$winmm->play; # Play the music
$winmm->volume(100); # Set volume after playing
$winmm->seek('00:32'); # seek to
#$winmm->pause; # Pause music playing
#$winmm->resume; # Resume music playing
@alicraigmile
alicraigmile / mxf.html
Created October 28, 2013 23:16
Some (at the time) interesting links about the MXF video format.
<html>
<head>
<title>mxf links</title>
</head>
<body>
<h1>mxf links</h1>
<ul>
<li><a href="http://sourceforge.net/projects/mxflib">mxflib (sourceforge)</a></li>
<li><a href="http://sourceforge.net/projects/klvlib">perl wrapper?</a></li>
<li><a href="http://www.freemxf.org/">http://www.freemxf.org/</a></li>
@alicraigmile
alicraigmile / fizzbuzz.pl
Created October 31, 2013 20:39
My take on the coding challenge, FizzBuzz.
#!/usr/bin/perl
use strict;
# (c) 2013 Ali Craigmile <[email protected]>
# [DONE] "Write a program
# [DONE] that prints the numbers from 1 to 100.
# [DONE] But for multiples of three print “Fizz” instead of the number
# [DONE] and for the multiples of five print “Buzz”.
'MC Hammer Time
MsgBox "Hammer Time?", vbCritical, "STOP!"
@alicraigmile
alicraigmile / getIPaddress.vbs
Created April 16, 2014 21:21
Retrieve IP addresses of each active network adapter on a Windows workstation
'Get all of the IP Addresses assigned to this workstation
Function GetIPAddress ()
Dim Count, line, IPAddress, myObj
Rem Start by finding the IP address
Set myObj = GetObject("winmgmts:{impersonationLevel=impersonate}!//localhost").ExecQuery("select IPAddress from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
Count = 0
For each IPAddress in myObj
@alicraigmile
alicraigmile / GetMem.vbs
Created April 16, 2014 21:22
How much memory does this Windows workstation have?
#GetMemory
strComputer = "."
Set wbemServices = GetObject("winmgmts:\\" & strComputer)
Set wbemObjectSet = wbemServices.InstancesOf("Win32_LogicalMemoryConfiguration")
For Each wbemObject In wbemObjectSet
WScript.Echo "Total Physical Memory (kb): " & wbemObject.TotalPhysicalMemory