Skip to content

Instantly share code, notes, and snippets.

View jcaxmacher's full-sized avatar
💭
Focused

J Axmacher jcaxmacher

💭
Focused
View GitHub Profile
@jcaxmacher
jcaxmacher / windows_auth.py
Created September 14, 2012 01:33 — forked from ig0774/windows_auth.py
WSGI middleware that provides SPNEGO authentication using the Win32 extensions
from base64 import b64decode, b64encode
from lru_dict import LruDict
import win32api
import win32security
import sspi, sspicon
__all__ = ['WindowsAuth']
def _get_user_name():
'''Uses the Windows API to retrieve the current user name'''
;;
;; NS CHEATSHEET
;;
;; * :require makes functions available with a namespace prefix.
;;
;; * :use makes functions available without a namespace prefix
;; (i.e., refers functions to the current namespace).
;;
;; * :import refers Java classes to the current namespace.
;;
body {
font: 12px sans-serif;
}
svg {
margin-top: 50px;
}
.chart rect {
stroke: white;
fill: steelblue;
}
#!/usr/bin/env python
#
# Converts any integer into a base [BASE] number. I have chosen 62
# as it is meant to represent the integers using all the alphanumeric
# characters, [no special characters] = {0..9}, {A..Z}, {a..z}
#
# I plan on using this to shorten the representation of possibly long ids,
# a la url shortenters
#
@jcaxmacher
jcaxmacher / oop.js
Created March 11, 2014 12:38 — forked from rahulkmr/oop.js
function mixin(dest) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var prop in source) {
if (!dest[prop]) {
dest[prop] = source[prop];
}
}
}
}

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results

r := mux.NewRouter()
// Single handler
r.HandleFunc("/form", use(http.HandlerFunc(formHandler), csrf, logging,)
// All handlers
http.Handle("/", recovery(r))
// Sub-routers
apiMiddleware := []func(http.Handler) http.Handler{logging, apiAuth, json}
angular.module('kcd.directives').directive('kcdRecompile', function($compile, $parse) {
'use strict';
return {
scope: true, // required to be able to clear watchers safely
compile: function(el) {
var template = el.html();
return function link(scope, $el, attrs) {
scope.$parent.$watch(attrs.kcdRecompile, function(_new, _old) {
var useBoolean = attrs.hasOwnProperty('useBoolean');
<div kcd-recompile="recompileAllTheThings" use-boolean>
<div ng-repeat="thing in ::things" kcd-recompile="thing.recompileCount">
<img ng-src="{{::thing.getImage()}}">
<span>{{::thing.name}}</span>
<button ng-click="thing.recompileCount=thing.recompileCount+1">Recompile This Thing</button>
</div>
</div>
<button ng-click="recompileAllTheThings=true">Recompile All Things!</button>