Skip to content

Instantly share code, notes, and snippets.

View telamonian's full-sized avatar

Max Klein telamonian

View GitHub Profile
@telamonian
telamonian / gist:875affc6e16cba8b8be08850c982555a
Created August 12, 2016 23:40
Working around SSL certificate issues in homebrew cask
Today I tried to install latexit using brew cask but couldn't:
$ brew cask install latexit
...
curl: (60) SSL certificate problem: Invalid certificate chain
...
Error: Download failed on Cask 'latexit' with message: Download failed: https://www.chachatelier.fr/latexit/downloads/LaTeXiT-2_8_1.dmg
Turns out that https://www.chachatelier.fr let their SSL certificate expire about a week ago. I still wanted to install latexit using brew, so here's what I did:
A fix that enables Pymol and the OSX native Aqua windowing system
to play nicely together. By Max Klein, mklein@jhu.edu
The complete code for this patch can be found on GitHub at
https://github.com/telamonian/pymol/tree/osx_gui_fix_-_invert_threads
Notes:
* Low level Apple libraries (Core Services) strictly enforce a rule
that only a program's main thread may initialize/interact with Tkinter
Aqua application windows.
@telamonian
telamonian / singleton.py
Created November 29, 2017 20:24 — forked from werediver/singleton.py
A thread safe implementation of singleton pattern in Python. Based on tornado.ioloop.IOLoop.instance() approach.
import threading
# Based on tornado.ioloop.IOLoop.instance() approach.
# See https://github.com/facebook/tornado
class SingletonMixin(object):
__singleton_lock = threading.Lock()
__singleton_instance = None
@classmethod
### Keybase proof
I hereby claim:
* I am telamonian on github.
* I am telamonian (https://keybase.io/telamonian) on keybase.
* I have a public key ASDHE221s_byyc95DHyR0mC0Pg5Nv-PhyK3yEap85xbOHQo
To claim this, I am signing this object:
@telamonian
telamonian / index.html
Last active May 27, 2020 20:48
regular-table/File Browser
<!--
Copyright (c) 2020, the Regular Table Authors.
This file is part of the Regular Table library, distributed under the terms of
the Apache License 2.0. The full license can be found in the LICENSE file.
-->
<!DOCTYPE html>
@telamonian
telamonian / xbox-one-wireless-protocol.md
Created June 16, 2020 03:57 — forked from alfredkrohmer/xbox-one-wireless-protocol.md
XBox One Wireless Controller Protocol

Physical layer

The dongle itself is sending out data using 802.11a (5 GHz WiFi) with OFDM and 6 Mbit/s data rate:

Radiotap Header v0, Length 38
    Header revision: 0
    Header pad: 0
    Header length: 38
    Present flags
@telamonian
telamonian / gist:c13f656c9e74b026e797b476505f3f98
Created September 30, 2020 04:24
parse string into numpy-style slice object

My problem: jupyterlab/jupyterlab-hdf5#4

I realllllly want to avoid having to write my own parser for this. Here's my best (very hacky) attempt so far:

# adapted from https://stackoverflow.com/a/43090200/425458

def parseSlice(sliceStr):
 return tuple((slice(*(int(i) if i else None for i in part.strip().split(':'))) if ':' in part else int(part.strip())) for part in sliceStr.split(','))
@telamonian
telamonian / register-jupyter-env
Last active March 3, 2021 11:46 — forked from thvitt/register-jupyter-env
Register a jupyter kernel for the current pyenv (with fix for Jupyter servers running in virtualenvs).
#!/bin/sh
if [ "$PYENV_VERSION" -ne "" ]
then
name=`pyenv version-name`
python=`pyenv which python`
else
name=`basename "$VIRTUAL_ENV"`
python="$VIRTUALENV/bin/python"
fi
@telamonian
telamonian / README.md
Last active March 31, 2021 04:05
tree-finder basic example

A basic example of using a <tree-finder> element to render and interact with a simple mock filesystem. The tree-finder.js script and some associated stylesheets are dynamically fetched at page load via the jsdelivr cdn.

tree-finder

A basic example of using a <tree-finder> element to render and interact with a simple mock filesystem. The tree-finder.js script and some associated stylesheets are dynamically fetched at page load via the jsdelivr cdn.

tree-finder