Skip to content

Instantly share code, notes, and snippets.

View singingwolfboy's full-sized avatar
Available for contract work

David Baumgold singingwolfboy

Available for contract work
View GitHub Profile
➜ micromasters git:(master) git checkout master
Already on 'master'
Your branch is up-to-date with 'origin/master'.
➜ micromasters git:(master) git pull
Already up-to-date.
➜ micromasters git:(master) node --version
v6.2.2
➜ micromasters git:(master) npm --version
3.9.5
➜ micromasters git:(master) sw_vers
@singingwolfboy
singingwolfboy / django-1.10.log
Created November 8, 2016 14:31
Comparing `manage.py migrate --list` and `manage.py showmigrations --list`
➜ micromasters git:(manage-py-showmigrations) docker-compose run web ./manage.py showmigrations --list
[2016-11-08 14:21:46] DEBUG 1 [django.db.backends] utils.py:90 - [e06944c115f6] - (0.001) SELECT (1) AS "a" FROM "wagtailimages_rendition" WHERE "wagtailimages_rendition"."filter_spec" = '' LIMIT 1; args=('',)
[2016-11-08 14:21:46] DEBUG 1 [django.db.backends] utils.py:90 - [e06944c115f6] - (0.003)
SELECT c.relname, c.relkind
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE c.relkind IN ('r', 'v')
AND n.nspname NOT IN ('pg_catalog', 'pg_toast')
AND pg_catalog.pg_table_is_visible(c.oid); args=None
[2016-11-08 14:21:46] DEBUG 1 [django.db.backends] utils.py:90 - [e06944c115f6] - (0.001) SELECT "django_migrations"."app", "django_migrations"."name" FROM "django_migrations"; args=()
@singingwolfboy
singingwolfboy / console.log
Created November 7, 2016 16:00
Successfully building docker-compose-2 branch
➜ micromasters git:(correctly-handle-faculty-without-images) git checkout docker-compose-2
Switched to branch 'docker-compose-2'
Your branch is up-to-date with 'origin/docker-compose-2'.
➜ micromasters git:(docker-compose-2) docker-compose --version
docker-compose version 1.8.1, build 878cff1
➜ micromasters git:(docker-compose-2) docker version
Client:
Version: 1.12.2
API version: 1.24
Go version: go1.7.1
@singingwolfboy
singingwolfboy / tier_models.py
Last active October 19, 2016 20:47
An example of how we might implement tiers that can be modified over time without losing the old information
class Tier(models.Model):
program = models.ForeignKey(Program)
name = models.TextField()
description = models.TextField()
@property
def current_version(self):
return self.tier_versions.order_by('-active_at').first()
@property
@singingwolfboy
singingwolfboy / model.py
Last active October 5, 2016 09:29
Well, since you offered to help...
from django.db import models
class Parent(models.Model):
name = models.CharField()
class Category(models.Model):
"Each Parent object has its own set of categories"
parent = models.ForeignKey(Parent, related_name="categories")
name = models.CharField()
@singingwolfboy
singingwolfboy / error.log
Created September 20, 2016 14:38
Error running `delete_realistic_search_data` management command
This file has been truncated, but you can view the full file.
➜ micromasters git:(improve-readme) docker-compose run web ./manage.py delete_realistic_search_data
System check identified some issues:
WARNINGS:
?: (1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dictionary takes precedence. You must put the values of the following settings into your default TEMPLATES dict: TEMPLATE_CONTEXT_PROCESSORS.
[2016-09-20 14:29:17] DEBUG 1 [django.db.backends] utils.py:89 - [7b117a7e72dc] - (0.001) SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."username"::text LIKE 'fake.%'; args=('fake.%',)
[2016-09-20 14:29:17] DEBUG 1 [django.db.backends] utils.py:89 - [7b117a7e72dc] - (0.001) SELECT "roles_role"."id", "roles_role"."user_id", "roles_role"."program_id", "roles_role"."role" F
@singingwolfboy
singingwolfboy / exception.log
Created September 19, 2016 18:35
Can't recreate elasticsearch index
➜ micromasters git:(master) docker-compose run web ./manage.py recreate_index
Pulling elastic (elasticsearch:latest)...
latest: Pulling from library/elasticsearch
8ad8b3f87b37: Already exists
751fe39c4d34: Already exists
b165e84cccc1: Pull complete
acfcc7cbc59b: Pull complete
04b7a9efc4af: Pull complete
b16e55fe5285: Pull complete
8c5cbb866b55: Pull complete
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///"
db1 = SQLAlchemy()
db2 = SQLAlchemy()
class Model1(db1.Model):
# revert https://github.com/mitchellh/vagrant/pull/7524
% sudo vim /opt/vagrant/embedded/gems/gems/vagrant-1.8.5/plugins/guests/ubuntu/guest.rb
% vagrant destroy
default: Are you sure you want to destroy the 'default' VM? [y/N] y
==> default: Forcing shutdown of VM...
==> default: Destroying VM and associated drives...
% vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'precise64'...
==> default: Matching MAC address for NAT networking...
@singingwolfboy
singingwolfboy / Vagrantfile
Last active August 8, 2016 17:44
Vagrant can't configure networks for Ubuntu Precise 12.04
Vagrant.require_version ">= 1.6.5"
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.network :private_network, ip: "192.168.33.10"
end