Skip to content

Instantly share code, notes, and snippets.

@conleym
conleym / jd.sql
Created November 8, 2019 04:51
awful query
-- Park cursor here on Line 1, hit RUN button
-- To covert from selectable to runtime, mass substitute 23192 or similar valid canvas_id for a course instead of :course
-- Engagement for Snapshot:
-- Run in 2 sections...select and run from line 314 up first, then remainder
-- Tables labeled with my initials had to be made in the public schema because I am read-only to Redshift.
-- They are temporary tables and drop at the close of session.
-- Engagement Score represents the computed_final_score (final course grade, 0 - 100) we would predict if using Engagement relative to the atomic section cohort as the sole predictor.
-- Per https://github.com/unizin/snapshot/wiki/Using-Canvas-Data-for-Snapshot#4-engagement-charts :
@conleym
conleym / generator.py
Last active November 20, 2017 15:36
Generate documents
import json
import random
import pytz
import uuid
from datetime import datetime, timedelta
from random_words import RandomNicknames, RandomWords
from elasticsearch import Elasticsearch
---
- hosts: localhost
gather_facts: no
become: no
vars:
db_stuff:
ev: ev
test: evtester
tasks:
@conleym
conleym / nxconfig.sh
Created November 20, 2016 23:59
Read nuxeo configuration into an associative array
# Get nuxeo config parameters as <name>=<value> pairs, one per line.
# grep gets rid of other output.
# Perform replacement so that the results can be assigned to an associative array.
RAW_CONFIG=$(
nuxeoctl --get-regexp config '.' |
grep '=' |
sed -r 's/([^=]*)=(.*)/\[\1\]="\2"/')
# Assign transformed results to an associative array.
@conleym
conleym / ec-vpc-tasks.yml
Last active July 26, 2016 19:02
Tasks to find the default VPC and its subnets
- name: Find default VPC for region
command: "aws ec2 describe-vpcs --region={{ region }} --output=json --filters=Name=isDefault,Values=true --query=Vpcs[0].VpcId"
register: default_vpc
- name: Set default_vpc_id fact
set_fact:
default_vpc_id: "{{ default_vpc.stdout | from_json }}"
- name: Find availability zones in the default VPC
ec2_vpc_subnet_facts:
@conleym
conleym / aws.sh
Last active November 2, 2016 18:15
Export AWS key variables based on profile name
# Shortcut for assigning a heredoc to a variable.
# http://stackoverflow.com/a/8088167
define() {
# read will have exit status 1 whenever it assigns to a variable or it gets to EOF.
read -r -d '' "${1}" || true
}
_other_aws_common_stuff() {
export AWS_DEFAULT_PROFILE="${AWS_PROFILE}"
local SCRIPT
@conleym
conleym / mac-setup.sh
Last active August 29, 2015 14:23
Some Mac things
# The first time you try to run `locate`, it will tell you the database hasn't been built and tell you to run this.
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
# I want to see all the files. Tell finder to show hidden files, too.
defaults write com.apple.finder AppleShowAllFiles YES
id label obsolete ordering
A101 CD standard audio format 0 1
A102 SACD super audio format 0 2
A103 MP3 format 0 3
A104 WAV format 0 4
A105 Real Audio format 0 5
A106 WMA 0 6
A107 AAC 0 7
A108 Ogg/Vorbis 0 8
A109 Audible 0 9