Skip to content

Instantly share code, notes, and snippets.

View dgw's full-sized avatar

dgw dgw

View GitHub Profile
@echo off
rem Copyright (C): 2010 Voyagerfan5761
rem http://technobabbl.es/
set USERPROFILE=%~dp0
set HOMEDRIVE=%~d0
set HOMEPATH=%~p0
set HOME=%~dp0
set HISTFILE=%USERPROFILE%.bash_history
rem set BASHRC=%USERPROFILE%.bashrc
@dgw
dgw / Xorg.0.log.failed
Created December 10, 2010 21:32
Four sample sessions from my Xorg.0.log files. To aid debugging hardware issues with my Dell Inspiron 2650 under Ubuntu.
/* ************************************** *
* This is the first sample session, when *
* the keyboard and touchpad were not *
* detected and didn't work *
* ************************************** */
[ 23.875]
X.Org X Server 1.9.0
Release Date: 2010-08-20
[ 23.875] X Protocol Version 11, Revision 0
@dgw
dgw / google-authenticator.php
Created October 13, 2011 04:29
Google Authenticator for WordPress - patch(es)
<?php
/*
Plugin Name: Google Authenticator
Plugin URI: http://henrik.schack.dk/google-authenticator-for-wordpress
Description: Two-Factor Authentication for WordPress using the Android/iPhone/Blackberry app as One Time Password generator.
Author: Henrik Schack
Version: 0.37
Author URI: http://henrik.schack.dk/
Compatibility: WordPress 3.2.1
Text Domain: google-authenticator
@dgw
dgw / Q1P3.java
Created October 18, 2011 00:58
Problem 3, Quiz 1, COSI 11A (Fall 2011), Brandeis University
/* ******************************** *\
* Package Name: Q1P3 *
* Description: The code from Quiz *
* 1, Problem 3 in the Fall 2011 *
* COSI 11A course at Brandeis. *
* Purpose: Demonstrating how the *
* given expressions really eval. *
\* ******************************** */
public class Q1P3 {
@dgw
dgw / wsa_endnotes.php
Created June 9, 2012 03:59
WSA Endnotes - Parse shortcodes in notes change
function wsa_the_content_filter( $content ) {
if ( is_single() ) {
$notes = wsa_endnotes( true );
if ( !empty($notes) ) {
$content .= '<div class="wsa-footnotes"><ol>';
foreach($notes as $i => $note) {
$num = $i + 1;
$content .= sprintf( '<li><a name="wsa-endnote-%d"></a>%s &nbsp;<a href="#wsa-inline-%d" class="wsa-up">&#9650;</a></li>',
$num, do_shortcode($note), $num
);
@dgw
dgw / log.cpp
Created August 20, 2013 20:13
log.cpp changes
CFile LogFile(sPath);
CString sLogDir = LogFile.GetDir();
struct stat ModDirInfo;
CFile::GetInfo(GetSavePath(), ModDirInfo);
if (!CFile::Exists(sLogDir)) CDir::MakeDir(sLogDir, ModDirInfo.st_mode);
if (LogFile.Open(O_WRONLY | O_APPEND | O_CREAT))
@dgw
dgw / keybase.md
Created March 28, 2014 14:17
keybase.md

Keybase proof

I hereby claim:

  • I am dgw on github.
  • I am dgw (https://keybase.io/dgw) on keybase.
  • I have a public key whose fingerprint is FD79 4B46 9B89 955F 2083 4558 7C9E E7B7 D379 F9CC

To claim this, I am signing this object:

@dgw
dgw / lastfm.php
Last active August 29, 2015 14:02 — forked from dewey/lastfm.php
Forked from dewey and changed to display "last listened to" if the latest track in the feed is not currently playing.
#!/usr/bin/php
<?php
$doc = new DOMDocument();
$doc->load("http://ws.audioscrobbler.com/2.0/user/voyagerfan5761/recenttracks.xml?limit=1");
$arrFeeds = array();
foreach ($doc->getElementsByTagName('track') as $node) {
$itemRSS = array (
'artist' => $node->getElementsByTagName('artist')->item(0)->nodeValue,
'name' => $node->getElementsByTagName('name')->item(0)->nodeValue,
'nowplaying' => ($node->attributes->getNamedItem('nowplaying')) ? true : false
@dgw
dgw / 01_README.md
Last active January 19, 2022 03:09 — forked from HumorBaby/01_README.md
Test script to stress-test sopel-irc/sopel-github#26;

Change as needed:

  • TEST_URL: set to local or remote test server
  • REAL_WEBHOOK_SECRET: match secret set in Sopel configuration
  • PAYLOAD: example has minimal payload required to be processed by the current sopel-github module (be68263d4aa4ddd6cb790e4e228b9894a3aaace0)
  • NUM_PROCS: number of simulateous processes to send requests
  • NUM_REQUESTS: total number of requests to send
  • RANDOM_SEED: change the distribution of valid/invalid requests by updating the starting random seed

Results:

  • . indicates a valid request sent