Skip to content

Instantly share code, notes, and snippets.

View louismullie's full-sized avatar

L louismullie

View GitHub Profile
@louismullie
louismullie / CDVAppDelegate.m
Last active June 21, 2018 00:25
didRegisterForRemoteNotificationsWithDeviceToken
@import Firebase;
@import FirebaseMessaging;
/**
* Manually set the APNS token when the user successfully registered for remote notifications
*/
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[[FIRMessaging messaging] setAPNSToken: deviceToken];
@louismullie
louismullie / flask_daemon.py
Created May 30, 2018 23:27
Lightest standalone Python Flask daemon server
# run with: gunicorn coreslicer:app --daemon
@app.route('/endpoint', methods = ['POST'])
def handle_endpoint_function():
pass
def app(environ, start_response):
port = 8000
app.run(host='0.0.0.0', port=port)
from flask import Flask, request, send_file
import numpy as np, os, json
from scipy.misc import imsave
from coreslicer import read_dcm
app = Flask(__name__)
APP_ROOT = os.path.dirname(os.path.abspath(__file__))
UPLOAD_FOLDER = os.path.join(APP_ROOT, '../tmp/coreslicer')
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
@louismullie
louismullie / images.txt
Created April 4, 2018 03:10
CoreSlicer-Images
Serves as a repository for images used in the CoreSlicer documentation
# on remote machine
cd /home/coreslicer/www/
mkdir coreslicer && cd coreslicer
git init
git config receive.denyCurrentBranch updateInstead
cd .. && mkdir coreslicer_pipeline && cd coreslicer_pipeline
git init
git config receive.denyCurrentBranch updateInstead
def window_level(arr, window_center, window_width, lut_min=0, lut_max=255):
# Basic sanity checking.
if np.isreal(arr).sum() != arr.size: raise ValueError
if lut_max != 255: raise ValueError
if arr.dtype != np.float64: arr = arr.astype(np.float64)
# Get window information.
window_width = max(1, window_width)
wc, ww = np.float64(window_center), np.float64(window_width)
#!/usr/bin/python
import sys, glob
import numpy as np
import os
import matplotlib.pyplot as plt
from matplotlib import colors
from scipy.signal import convolve2d
import scipy
from scipy import ndimage
from scipy.misc import imread
@louismullie
louismullie / gist:30ecbb4951c2497d870c
Created January 18, 2016 04:34
PSOAS YALLAH IT WORKS
#!/usr/bin/python
import sys, glob
import numpy as np
import os
import matplotlib.pyplot as plt
from matplotlib import colors
from scipy.signal import convolve2d
import scipy
from scipy import ndimage
from scipy.misc import imread
class FalseClass
def +(b); 0 + b.to_i; end
def to_i; 0; end
end
class TrueClass
def +(b); 1 + b.to_i; end
def to_i; 1; end
end
from __future__ import print_function
"""
A very simple 'animation' of a 3D plot
"""
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
import numpy as np
import time
def generate(X, Y, phi):