Skip to content

Instantly share code, notes, and snippets.

View neurosnap's full-sized avatar

Eric Bower neurosnap

View GitHub Profile
@neurosnap
neurosnap / gist:9360098
Created March 5, 2014 02:31
Anonymize a DICOM
def anonymize(filename, output_filename, new_person_name="anonymous",
new_patient_id="id", remove_curves=True, remove_private_tags=True):
def sanitize_html(dataset):
"""Removing all potential XSS attacks embedded within the dicom file"""
dataset.walk(sanitize_callback)
return dataset
def sanitize_callback(dataset, data_element):
"""Call from dataset "walk" recursive function for all data elements. """
upstream eaa_app_server {
server unix:/srv/www/eaa/run/gunicorn.sock fail_timeout=0;
}
server {
listen 80;
server_name eaa.neurosnap.net;
client_max_body_size 4G;
@neurosnap
neurosnap / gist:3a1824c31643367bbb0e
Created June 30, 2014 13:29
gdcmswig.py -- DataElement
class DataElement(_object):
"""
Class to represent a Data Element either Implicit or Explicit.
DATA ELEMENT: A unit of information as defined by a single entry in
the data dictionary. An encoded Information Object Definition ( IOD)
Attribute that is composed of, at a minimum, three fields: a Data
Element Tag, a Value Length, and a Value Field. For some specific
Transfer Syntaxes, a Data Element also contains a VR Field where the
Value Representation of that Data Element is specified explicitly.
@neurosnap
neurosnap / gist:f7f9989941ef21346332
Created July 8, 2014 18:25
V3 SpokenLayer landing.js
$(function() {
$("#nol_start").on("click", function() {
$("#sl_queue > div").each(function() {
sl_start(this);
});
});
$(".nol_play").on("click", function() {
//sl_start(this);
@neurosnap
neurosnap / gist:c1580fe7b33f65330c23
Last active August 29, 2015 14:03
Array of dictionaries to group data
@app.route('/')
def landing():
arts = Articles.query.\
filter(Articles.active==True).\
filter(Articles.ready==True).all() #.\
#order_by(desc(Articles.created)).all()
# get today's date
today = datetime.date.today()

Unfortunately, the Cisco AnyConnect client for Mac conflicts with Pow. And by "conflicts", I mean it causes a grey-screen-of-death kernel panic anytime you connect to the VPN and Pow is installed.

As an alternative, there is OpenConnect, a command-line client for Cisco's AnyConnect SSL VPN.

Here's how to get it set up on Mac OS X:

  1. OpenConnect can be installed via homebrew:

     brew update
    

brew install openconnect

@neurosnap
neurosnap / author.py
Created May 4, 2015 14:51
Authors on Freep Article
# -*- coding: utf-8 -*-
from __future__ import print_function
import re
import requests
# lets download the article web page
r = requests.get('http://www.freep.com/story/life/advice/2015/05/04/mother-law-meant-selfish/26706999/')
print("Grabbing data from {}".format(r.url))
r.raise_for_status()
@neurosnap
neurosnap / wat.py
Last active September 10, 2015 13:49
members = {
"class": self._class,
"number": self.number,
"part_number": self.part_number,
"description": self.description,
"quantity": self.quantity,
}
return """Class: {class}\t
Number: {number}\t
async function getThreads(api, dispatch) {
try {
let mailboxes = await api.get(`mailboxes`);
mailboxes = mailboxes.mailboxes;
for (let i = 0; i < mailboxes.length; i++) {
let box = mailboxes[i];
let inbox = await api.get(`mailboxes/${box.id}/threads/folder/in`);
for (let i = 0; i < inbox.threads.length; i++) {
function main(sources) {
const auth$ = Auth(sources);
const apiDomain = getAPIDomain();
const apiMailboxes = `${apiDomain}/mailboxes`;
const getMailboxes$ = auth$.state$.map(accInfo => {
console.log(accInfo);
return {
url: apiMailboxes,