Skip to content

Instantly share code, notes, and snippets.

View jeremyrsellars's full-sized avatar

Jeremy R. Sellars jeremyrsellars

  • Liberty, MO, USA
View GitHub Profile
@jeremyrsellars
jeremyrsellars / optional json config in coffeescript.coffee
Created June 5, 2012 13:10
Beautiful Coffeescript try assignment for configuration
# prefer the config file, if it exists.
authOptions =
try
require './oauth.config.json'
catch e
{
'host': 'localhost',
'port': '80',
'token': '/account/token',
'principal': '/account/principal',
@jeremyrsellars
jeremyrsellars / DeclarativeExpressResource.coffee
Created July 18, 2012 00:16
Declarative Express Resources
addAllResources: ->
resources =
'courses':
module: require "./courses.coffee"
children:
'studentGroups':
module: require "./studentGroups.coffee"
'studentAudits':
module: require "./studentAudits.coffee"
'students':
@jeremyrsellars
jeremyrsellars / binarySearchDemo.n
Created November 16, 2012 20:52
Binary Search of sorted array in Nemerle
#pragma indent
using System.Console
module Program
public Main() : void
def items = array[1,2,2,2,2,2,2,2,4,8,10,12]
def assertIndexOfXisY(item : int, expected : int)
def actual = Demo.BinarySearch(items, item)
WriteLine((if(actual == expected) "Correct " else "Incorrect") + " for item: " + item)
class Evade < RTanque::Bot::Brain
NAME = 'Evade'
include RTanque::Bot::BrainHelper
TURRET_FIRE_RANGE = RTanque::Heading::ONE_DEGREE * 3.0
def initialize(x)
super(x)
@power = 0
@ticksSinceEnemy = 0
@jeremyrsellars
jeremyrsellars / rdp_protocol_handler.reg
Created April 30, 2014 15:08
RDP Protocol Handler registry
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\rdp]
@="URL:Remote Desktop Protocol <URL:Remote%20Desktop%20Protocol> "
"EditFlags"=dword:00000002
"URL Protocol"=""
[HKEY_CLASSES_ROOT\rdp\shell]
[HKEY_CLASSES_ROOT\rdp\shell\open]
@jeremyrsellars
jeremyrsellars / zero-sum-game.clj
Created June 3, 2014 02:52
Pick the +/- operator to put between each digit from 1 to N
(defn zero-sum-game [n]
(let [explode
(fn explode [old item]
(concat (map #(cons item %) old)
(map #(cons (- item) %) old)))
candidate-combinations
(->> (range 2 (inc n))
(reduce explode ['(1)]))
sum-is-zero?
(fn sum-is-zero? [a-seq-of-numbers] (zero? (apply + a-seq-of-numbers)))
http://solrserver:8080/solr/notes/select?q=*%3A*&fq=type%3Apathology&rows=0&wt=json&indent=true&facet=true&facet.date.gap=%2B1DAY&facet.date=date&facet.date.start=2014-07-01T00:00:00Z&facet.date.end=2014-08-01T00:00:00Z

If you're using the the Solr management web UI, you can paste this into the Raw Query Parameters:

facet.date.gap=%2B1DAY&facet.date=date&facet.date.start=2014-07-01T00:00:00Z&facet.date.end=2014-08-01T00:00:00Z

This will count the number of exams in each 1-day period in July.

@jeremyrsellars
jeremyrsellars / delete_placeholders.sql
Created July 24, 2014 21:32
Delete ClarityConnect placeholder records that have been superseded
use illuminatedb
go
-- note, it is possible for the placeholder hash to change with new versions of ClarityConnect, replace this where necessary.
select distinct NoteId
into #PublishedNoteIds
from Clarity.NoteVersion NV
inner join Clarity.PublishedNoteVersion PNV on PNV.NoteVersionId=NV.NoteVersionId AND NV.HeaderHash <> '89C4E5D1-4BC6-2C9F-9754-1270646437D0'
@jeremyrsellars
jeremyrsellars / contains7.clj
Created September 24, 2014 18:21
Does this base-10 number contain the digit 7? (a career fair question solution)
(defn contains-7? [number]
(if (zero? number) false
(letfn [(seven? [n]
(== 7 n))
(one-digit? [n]
(< n 10))
(leading-digit [n]
(int
(if (one-digit? n)
n
@jeremyrsellars
jeremyrsellars / rage-against-the-cage-and-forefront
Last active August 29, 2015 14:14
Disable Forefront virus scanner to root android phone
REM Get around the Forefront virus scanner
REM cannot open 'rageagainstthecage-arm5.bin': No such file or directory
ECHO WARNING This disables your virus/malware scanner
pause
taskkill /f /im fcssas.exe
taskkill /f /im msmpeng.exe
taskkill /f /im MSASCui.exe
taskkill /f /im MOMService.exe
REM Unblocks the file... see https://technet.microsoft.com/en-us/sysinternals/bb897440.aspx