Skip to content

Instantly share code, notes, and snippets.

View milljm's full-sized avatar

Jason Miller milljm

View GitHub Profile
@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 June 23, 2020 15:15
Bash profile multi-line, conda/git detection support. Detects when to display user@host (when SSH'd in)
#################################
export CLICOLOR=1
export LSCOLORS=exfxcxdxbxegedabagacad
alias ll='ls -latrh'
alias l='ls -latrh'
# git branch function (stole this from ohmyzsh)
function git_current_branch() {
local ref
ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null)
@milljm
milljm / .zshrc
Last active June 23, 2020 15:19
.zshrc profile multi-line, conda/git detection support. Detects when to display user@host (when SSH'd in)
#################################
export CLICOLOR=1
export LSCOLORS=exfxcxdxbxegedabagacad
alias ll='ls -latrh'
alias l='ls -latrh'
export CONDA_HOSTNAME=`hostname`
setopt noautomenu
setopt nomenucomplete
setopt auto_cd
setopt PROMPT_SUBST
@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):
diff -ruN a/coregrind/m_syscall.c b/coregrind/m_syscall.c
--- a/coregrind/m_syscall.c 2016-10-21 04:37:39.000000000 -0600
+++ b/coregrind/m_syscall.c 2016-10-31 10:02:39.000000000 -0600
@@ -33,6 +33,7 @@
#include "pub_core_vki.h"
#include "pub_core_vkiscnums.h"
#include "pub_core_syscall.h"
+#define __private_extern__ extern
/* ---------------------------------------------------------------------
@milljm
milljm / argparse.py
Created April 27, 2016 16:00
Argument Parser
#!/usr/bin/env python
import argparse
def parseArguments(args=None):
parser = argparse.ArgumentParser(description='argparse tester')
parser.add_argument('-t', '--test', nargs="?", const='moose', help='None, default=moose, or value')
return parser.parse_args(args)
if __name__ == '__main__':
args = parseArguments()