Skip to content

Instantly share code, notes, and snippets.

🎯
Working on everything and anything.

David R. Longnecker drlongnecker

🎯
Working on everything and anything.
Block or report user

Report or block drlongnecker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View macrochanger.lua
-- A quick rewrite of the Windower addon for Ashita v3 that swaps your macro pallette on job change.
-- Yes, I'm lazy.
_addon.name = 'MacroChanger'
_addon.author = 'Derahine'
_addon.version = '1.0.0.0'
require 'common'
jobs = {
@drlongnecker
drlongnecker / group_child_by_date.js
Last active Aug 29, 2015
Counting child documents by full date in MongoDB
View group_child_by_date.js
// grab article.comments, group by date (roll times up to full days), count up instances to get full counts per day.
// gotta be a better way...
db.Article.aggregate(
{$unwind: '$Comments'},
{$group: { _id: '$Comments.DateCreated', count : {$sum: 1 }}},
{$match: { '_id' : { $gte: ISODate('2014-02-21 00:00:00'), $lte: ISODate('2014-02-28 23:59:59') } }},
{$project: { _id: 0, count: 1, 'date': '$_id', h: { $hour: '$_id' }, m: { $minute: '$_id'}, s: { $second: '$_id' }, ml: {$millisecond: '$_id'} } },
{$project: { count: 1, 'dt': { "$subtract" : [ "$date", { "$add" : [ "$ml", { "$multiply" : [ "$s", 1000 ] }, { "$multiply" : [ "$m", 60, 1000 ] }, { "$multiply" : [ "$h", 60, 60, 1000 ] } ] } ] } }},
{$group: { _id: '$dt', count: { $sum: '$count' } } },
View lazymerge.ps1
# for when you're just too lazy to type out the merge command
# and change branches
function merge([string] $target, [string] $source) {
if ($source -eq "") {
$symbolicref = git symbolic-ref HEAD
$source = $symbolicref.substring($symbolicref.LastIndexOf("/") +1)
}
write-host "Merging $source into $target" -for white -ba red
git checkout $target; git merge $source; git checkout $source
@drlongnecker
drlongnecker / rift.ahk
Created Mar 23, 2012
RIFT Melee Tab-Out Prevention!
View rift.ahk
#IfWinActive, RIFT
!Tab::
send {tab}
return
#Tab::
send {tab}
return
#IfWinActive
@drlongnecker
drlongnecker / deploy.xml
Created Feb 10, 2012
DeployTo PowerShell xml configuration file
View deploy.xml
<?xml version="1.0" encoding="utf-8" ?>
<settings>
<common>
<release>.\release</release>
<web.config>
<appsettings>
</appsettings>
</web.config>
</common>
@drlongnecker
drlongnecker / DeployTo.ps1
Created Feb 10, 2012
DeployTo PowerShell build backup and deployment script.
View DeployTo.ps1
param (
[string]$Deploy,
[switch]$SkipBackup,
[string]$Settings = "settings.xml"
)
$success = $false
function writeError($message) {
Write-Host $message -Foreground Red
break;
@drlongnecker
drlongnecker / SendTo-Campfire.ps1
Created Jan 16, 2012
Posting to Campfire from PowerShell
View SendTo-Campfire.ps1
param (
[string]$RoomNumber = (Read-Host "The room to post to (default: 123456) "),
[string]$Message = (Read-Host "The message to send ")
)
$defaultRoom = "123456"
if ($RoomNumber -eq "") {
$RoomNumber = $defaultRoom
}
$authToken = "YOUR AUTH TOKEN"
@drlongnecker
drlongnecker / OracleSQLAliasToBeanTransformer.cs
Created Jan 13, 2012
Addressing issues in Oracle.DataAccess and AliasToBeanTransformer
View OracleSQLAliasToBeanTransformer.cs
[Serializable]
public class OracleSQLAliasToBeanTransformer : IResultTransformer
{
const BindingFlags Flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
readonly System.Type _resultClass;
ISetter[] _setters;
readonly IPropertyAccessor _propertyAccessor;
readonly ConstructorInfo _constructor;
readonly PropertyInfo[] _fields;
public OracleSQLAliasToBeanTransformer(Type resultClass)
@drlongnecker
drlongnecker / Set-PrinterByLocation.ps1
Created Jan 13, 2012
Setting the default printer based on network subnet.
View Set-PrinterByLocation.ps1
$homeNet = "10.1.4.*", "OfficePrinter"
$remoteNet = "10.1.6.*", "W382_HP_Printer"
function Set-DefaultPrinter([string]$printerPath) {
$printers = gwmi -class Win32_Printer -computer .
Write-Host -fore cyan "Default Printer: $printerPath"
$dp = $printers | ? { $_.deviceID -match $printerPath }
$dp.SetDefaultPrinter() | Out-Null
}
@drlongnecker
drlongnecker / gist:1593302
Created Jan 11, 2012
Adding a Launcher icon in Ubuntu 11.10
View gist:1593302
gnome-desktop-item-edit ~/Desktop/ --create-new
#just so I don't forget... again.
You can’t perform that action at this time.