Skip to content

Instantly share code, notes, and snippets.

View jdreaver's full-sized avatar

David Reaver jdreaver

View GitHub Profile
@jaredks
jaredks / listdict_setitem_subclass.py
Last active May 23, 2019 06:42
OrderedDict subclass implementing insertion methods to adjust the order.
from collections import OrderedDict as _OrderedDict
try:
from thread import get_ident as _get_ident
except ImportError:
from dummy_thread import get_ident as _get_ident
class ListDict(_OrderedDict):
def __init__(self, *args, **kwds):
try:
@theanalyst
theanalyst / pushbullet.el
Last active January 28, 2019 01:20
Easily push from your emacs to Android phone??
;;; pushbullet.el --- An emacs client for the pushbullet android app
;;; Using the pushbullet api at https://pushbullet.com/api
;;; Uses grapnel for http requests https://github.com/leathekd/grapnel
;;;
;;; Commentary:
;;;
;;; Code:
(require 'grapnel)
(require 'json)
@tacaswell
tacaswell / simp_zoom.py
Last active February 12, 2023 07:19
factory for adding zoom callback to matplotlib graphs
import matplotlib.pyplot as plt
def zoom_factory(ax,base_scale = 2.):
def zoom_fun(event):
# get the current x and y limits
cur_xlim = ax.get_xlim()
cur_ylim = ax.get_ylim()
# set the range
cur_xrange = (cur_xlim[1] - cur_xlim[0])*.5