Skip to content

Instantly share code, notes, and snippets.

View milljm's full-sized avatar

Jason Miller milljm

View GitHub Profile
@milljm
milljm / bless.py
Last active April 21, 2025 11:48
Recursively seek out and remove duplicate LC_RPATH entries from linked libraries with supplied binary
#!/usr/bin/env python3
''' A tool which searches recursively and removes duplicate loader paths '''
import subprocess
import sys
import os
def run_command(command):
"""Run a shell command and return the output."""
try:
result = subprocess.run(command, check=True, text=True, capture_output=True)
@milljm
milljm / speak.py
Last active April 11, 2025 02:05
Kokoro txt --> speech
#!/usr/bin/env python3
""" a quick text to speech tool """
import os
import sys
import argparse
import sounddevice as sd
import warnings
warnings.filterwarnings('ignore')
try:
from IPython.display import display, Audio
@milljm
milljm / channel_helper.py
Last active October 8, 2020 13:56
Help tool for managing packages contained in Conda channels
#!/usr/bin/env python3
### Usage:
### ./get_packages.py get url arch
### Examples:
### ./get_packages.py get https://conda.anaconda.org/idaholab linux-64
import requests, re, sys, argparse, os
from urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning)
@milljm
milljm / .bash_profile
Last active March 25, 2025 15:32
Bash profile multi-line, conda/git detection support.
#!/bin/bash
export HISTSIZE=2000000
export HISTFILESIZE=2000000
export CLICOLOR=1
export LSCOLORS=exfxcxdxbxegedabagacad
alias ll="ls --color -latrh $@"
alias ls="ls --color $@"
########## Pretty Prompt ###########
@milljm
milljm / .zshrc
Last active April 25, 2025 12:38
.zshrc profile multi-line, conda/git detection support. Add git diff detection
#################################
export CLICOLOR=1
export LSCOLORS=exfxcxdxbxegedabagacad
alias ll='ls -latrh'
alias l='ls -latrh'
setopt noautomenu
setopt nomenucomplete
setopt auto_cd
setopt PROMPT_SUBST
autoload -U colors && colors
@milljm
milljm / inverse_highlighting.lisp
Last active March 12, 2020 14:10
Inverse line highlighting in Emacs (highlight the line you *were* on in the *other* buffer)
;; Highlight line for _inactive_ windows ::
;; Credit to https://emacs.stackexchange.com/questions/14638/change-highlight-color-when-window-isnt-in-focus
;; Answerer: https://emacs.stackexchange.com/users/780/glucas
(require 'hl-line)
(set-face-background hl-line-face "#333")
(defface hl-line-inactive
'((t nil))
"Inactive variant of `hl-line'."
:group 'hl-line)
@milljm
milljm / print_formatted_message.sh
Last active January 24, 2019 19:07
BASH auto-justify help function
#!/bin/bash
function print_arrays()
{
#### This function uses indirect expansion (pass variable name, not the value)
##
## Syntax: print_arrays args args_about
##
## Where args and args_about are arrays containing double quoted content:
##
## args=("-h|--help"\
@milljm
milljm / thread_test.py
Last active January 4, 2022 20:47
Shared Thread Pool
#!/usr/bin/env python
import os, traceback
from time import sleep
from multiprocessing.pool import ThreadPool
import threading # for thread locking and thread timers
class Scheduler:
"""
A simple threading scheduler.
Instance Scheduler(int), where int is the ammount of processors you wish to
@milljm
milljm / gist:0190123a70fb8956374f525c031a2b0a
Last active May 17, 2017 21:31
Reverse Dependency Resolver
#!/usr/bin/env python
# Credit for DependencyResolver goes to: http://code.activestate.com/recipes/576570-dependency-resolver/
class DependencyResolver:
def __init__(self):
self.dependency_dict = {}
def insertDependency(self, key, values):
self.dependency_dict[key] = values
#!/usr/bin/env python
import argparse, os, io, sys, time
import SocketServer, socket
import Queue
import threading
import tempfile
global thread_storage
thread_storage = {}
class ThreadedTCPServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):