Skip to content

Instantly share code, notes, and snippets.

@jtriley
jtriley / boss-access-token.sh
Last active Mar 31, 2017
Shell script for requesting a boss OIDC access token
View boss-access-token.sh
#!/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
View keybase.md

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 Aug 29, 2015
$EDX_PLATFORM_ROOT/lms/envs/private.py
View 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 Dec 4, 2013
Small example showing how to use the ClusterManager class for high-level cluster management.
View clustermanager-example.py
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 Nov 1, 2013
Simple Python script that computes both public and private RSA key fingerprints as used by Amazon EC2
View ec2-fingerprint-key
#!/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(
View starcluster_loadbalance_supervisor.conf
[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 Apr 2, 2013
Plugin for StarCluster that configures a boto credentials file for the cluster user
View gist:5295096
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 Oct 11, 2015
IPython Parallel Push/Execute/Pull Demo
View ipy_parallel_push_exec_pull.ipynb
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 Oct 5, 2012
$HOME/.ssh/config for EC2
View ssh_config_ec2
Host ec2*
IdentityFile /path/to/your/ssh/key
@jtriley
jtriley / combinexml.py
Created Sep 5, 2012
Combine similar XML files into one document
View combinexml.py
# 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