Skip to content

Instantly share code, notes, and snippets.

@jtriley
jtriley / boss-access-token.sh
Last active February 1, 2023 07:25
Shell script for requesting a boss OIDC access token
#!/bin/bash
BOSS_TOKEN_URL="https://auth.theboss.io/auth/realms/BOSS/protocol/openid-connect/token"
echo -n "BOSS Username: "
read BOSS_USER
echo -n "BOSS Password: "
read -s BOSS_PASSWORD
echo -en "\nBOSS Client Id: "
read BOSS_CLIENT_ID
@jtriley
jtriley / keybase.md
Last active November 14, 2016 18:13

Keybase proof

I hereby claim:

  • I am jtriley on github.
  • I am jtriley (https://keybase.io/jtriley) on keybase.
  • I have a public key ASAOFDG0YCtUZcaWZrjbJGvF2J7BAk3_sntdNkYawPTmRgo

To claim this, I am signing this object:

@jtriley
jtriley / private.py
Last active August 29, 2015 14:05
$EDX_PLATFORM_ROOT/lms/envs/private.py
from .devstack import * # pylint: disable=wildcard-import, unused-wildcard-import
from .common import INSTALLED_APPS, MIDDLEWARE_CLASSES
FEATURES['ENABLE_SYSADMIN_DASHBOARD'] = True
FEATURES['INDIVIDUAL_DUE_DATES'] = True
def tuple_without(source_tuple, exclusion_list):
"""Return new tuple excluding any entries in the exclusion list. Needed because tuples
are immutable. Order preserved."""
return tuple([i for i in source_tuple if i not in exclusion_list])
@jtriley
jtriley / clustermanager-example.py
Created December 4, 2013 20:27
Small example showing how to use the ClusterManager class for high-level cluster management.
from starcluster import config
from starcluster import cluster
cfg = config.StarClusterConfig().load()
ec2 = cfg.get_easy_ec2()
cm = cluster.ClusterManager(cfg, ec2=ec2)
cl = cm.get_cluster("your_running_cluster_tag")
print len(cl.running_nodes)
@jtriley
jtriley / ec2-fingerprint-key
Created November 1, 2013 19:28
Simple Python script that computes both public and private RSA key fingerprints as used by Amazon EC2
#!/usr/bin/env python
import hashlib
import optparse
import paramiko
from Crypto.PublicKey import RSA
def insert_char_every_n_chars(string, char='\n', every=64):
return char.join(
@jtriley
jtriley / starcluster_loadbalance_supervisor.conf
Created October 30, 2013 20:54
Supervisor (https://pypi.python.org/pypi/supervisor) config for StarCluster's loadbalancer
[unix_http_server]
file=/tmp/supervisor.sock
[supervisord]
logfile=/tmp/supervisord.log
logfile_maxbytes=50MB
logfile_backups=10
loglevel=info
pidfile=/tmp/supervisord.pid
nodaemon=false
@jtriley
jtriley / gist:5295096
Created April 2, 2013 18:55
Plugin for StarCluster that configures a boto credentials file for the cluster user
import os
from starcluster import clustersetup
from starcluster.logger import log
BOTO_CFG_TEMPLATE = """\
[Credentials]
aws_access_key_id = %(aws_access_key_id)s
aws_secret_access_key = %(aws_secret_access_key)s
@jtriley
jtriley / ipy_parallel_push_exec_pull.ipynb
Last active October 11, 2015 13:37
IPython Parallel Push/Execute/Pull Demo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jtriley
jtriley / ssh_config_ec2
Created October 5, 2012 15:13
$HOME/.ssh/config for EC2
Host ec2*
IdentityFile /path/to/your/ssh/key
@jtriley
jtriley / combinexml.py
Created September 5, 2012 15:49
Combine similar XML files into one document
# From: http://tentacles.posterous.com/43038706
# Take a bunch of XML files on the command line and merge them into
# one big XML document.
#
# The root element will come from the first document; the root elements of
# subsequent documents will be lost, as will anything outside the root
# (comments and whatnot).
import sys
import libxml2