Skip to content

Instantly share code, notes, and snippets.

View banesullivan's full-sized avatar
🛠️
I may be slow to respond.

Bane Sullivan banesullivan

🛠️
I may be slow to respond.
View GitHub Profile
@n-st
n-st / .bash_profile
Created May 29, 2016 12:04
Start zsh from bashrc. Useful when you can't use chsh or when the same LDAP account is used both on systems with zsh installed and ones without.
# .bash_profile is executed for login shells,
# .bashrc is executed for interactive non-login shells.
# We want the same behaviour for both, so we source .bashrc from .bash_profile.
# Also, when .bash_profile exists, bash ignores .profile, so we have to source
# it explicitly.
if [ -f "$HOME/.profile" ]; then
. "$HOME/.profile"
fi
@thvitt
thvitt / register-jupyter-env
Last active February 17, 2025 16:55
Register a jupyter kernel for the current pyenv.
#!/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
@sgillies
sgillies / advanced_rasterio_features.ipynb
Last active October 19, 2024 17:20
Advanced Rasterio features notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@GuillaumeFavelier
GuillaumeFavelier / vtk_radio_button.py
Created December 19, 2019 12:39
Example of vtkButtonWidget and vtkBalloonWidget interactions
import vtk
def CreateButtonOff(image):
white = [255, 255, 255]
CreateImage(image, white, white)
def CreateButtonOn(image):
white = [255, 255, 255]
@MarcSkovMadsen
MarcSkovMadsen / messages.py
Last active October 9, 2024 01:58
Panel with Tranquilizer REST API
import ast
import requests
url = 'http://localhost:5006/rest/post_data'
def post(value):
data = {'data': value}
response = requests.post(url, data = data)
if response.status_code==200:
print(ast.literal_eval(response.text))
@manthey
manthey / tiff_to_uml.py
Last active April 28, 2022 14:45
Use tifftools and plantuml to create an svg diagram.
import argparse
import base64
import io
import json
import math
import os
import subprocess
import sys
import tempfile
@manzt
manzt / anywidget-arrow.ipynb
Last active December 4, 2024 22:28
anywidget-arrow.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@schaumb
schaumb / st_route.py
Last active July 24, 2024 15:59
Streamlit - Support custom HTTP requests
import functools
import gc
import weakref
from typing import Optional, Callable, Union
from weakref import WeakSet
from streamlit import config
from streamlit.runtime import Runtime
from streamlit.runtime.scriptrunner import get_script_run_ctx, add_script_run_ctx
from streamlit.web.server.server_util import make_url_path_regex
@aadnk
aadnk / injectApi.py
Last active November 13, 2024 08:01
Inject a REST API into Streamlit by injecting into Tornado
import logging
import threading
from typing import Any, Dict, Iterable, Optional, Union
from tornado.routing import Rule, Matcher
_global_tornado_hook = None
_global_hook_lock = threading.RLock()
class CustomRule:
def __init__(self, path_pattern: Union[str, Matcher], handler_class: Any,