Skip to content

Instantly share code, notes, and snippets.

###############################################################################
# Class: PumaSubmitter_sbatch
#
# Purpose: Launch an MPI job with sbatch.
#
# Programmer: Devin Bayly (extending Brad Whitlock's work)
# Date: Thu May 17 14:22:04 PDT 2012
#
# Modifications:
# Satheesh Maheswaran, Tue Jan 15 14:47:54 GMT 2013
@DevinBayly
DevinBayly / simple_cors_server.py
Created December 10, 2021 23:27 — forked from acdha/simple_cors_server.py
Python 3: serve the current directory as HTTP while setting CORS headers for XHR debugging
#!/usr/bin/env python3
# encoding: utf-8
"""Use instead of `python3 -m http.server` when you need CORS"""
from http.server import HTTPServer, SimpleHTTPRequestHandler
class CORSRequestHandler(SimpleHTTPRequestHandler):
def end_headers(self):
self.send_header('Access-Control-Allow-Origin', '*')
@DevinBayly
DevinBayly / spec.json
Created October 18, 2021 18:47
Vega-Lite spec from Mon Oct 18 2021
{
"data": {
"url": "https://gist.githubusercontent.com/DevinBayly/946ca3386bc910be49121e209f8a6d5b/raw/d38bbfc4315abac24198b90c9958fda95979ca5c/iris.json"
},
"mark": "bar",
"encoding": {
"y": {
"aggregate": "mean",
"field": "petal_length",
"type": "quantitative"
@DevinBayly
DevinBayly / spec.json
Created July 16, 2021 19:40
aggregation
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Plot showing a 30 day rolling average with raw values in the background.",
"title":"Learning Vega",
"data": {
"url": "https://gist.githubusercontent.com/DevinBayly/a4bbb3b0f1293f0b4d373bc99e1917cc/raw/ca4376a0255d00885866be5b7f395743833321e9/vega_data.json"
},
"width": 400,
"height": 300,
@DevinBayly
DevinBayly / spec.json
Created July 16, 2021 19:40
Vega-Lite spec from Fri Jul 16 2021
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Plot showing a 30 day rolling average with raw values in the background.",
"title":"Learning Vega",
"data": {
"url": "https://gist.githubusercontent.com/DevinBayly/a4bbb3b0f1293f0b4d373bc99e1917cc/raw/ca4376a0255d00885866be5b7f395743833321e9/vega_data.json"
},
"width": 400,
"height": 300,
@DevinBayly
DevinBayly / spec.json
Created July 16, 2021 15:55
some faceting
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Plot showing a 30 day rolling average with raw values in the background.",
"title":"Learning Vega",
"data": {
"url": "https://gist.githubusercontent.com/DevinBayly/a4bbb3b0f1293f0b4d373bc99e1917cc/raw/ca4376a0255d00885866be5b7f395743833321e9/vega_data.json"
},
"facet":{"row":{"field":"category"},"col":{"field":"category"}},
"spec":{
@DevinBayly
DevinBayly / spec.json
Created July 16, 2021 15:22
Vega-Lite spec from Fri Jul 16 2021
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Plot showing a 30 day rolling average with raw values in the background.",
"width": 400,
"height": 300,
"data": {
"url": "https://gist.githubusercontent.com/DevinBayly/a4bbb3b0f1293f0b4d373bc99e1917cc/raw/710cd28eb5e458f270c5686823887ff19c8b998f/vega_data.json"
},
"mark": "point",
"encoding": {
@DevinBayly
DevinBayly / grid.ipynb
Created June 11, 2021 19:11
vectorization_experiment
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import time
import socket
import socketserver
import ssl
import numpy as np
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
## the reusaddr part means you don't have to wait to restart
s.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
from numba import njit
import numpy as np
from itertools import product
# %%
dim = 800
boidcount = 3000
frame = np.ones((dim,dim,3)).astype("uint8")*255
nbhds = np.array([list(product(np.arange(-1,1), np.arange(-1,1)))]).reshape(-1,2)
positions = None