Skip to content

Instantly share code, notes, and snippets.

@efischer19
efischer19 / On Clean Commits.md
Last active March 13, 2022 00:57
Commit Hygiene; a treatise on the Whys and Hows

Introduction

Commits (or changesets/patches) are the effective results of a developer's coding efforts. They describe a delta, or difference in contents that all other developers using a given codebase should also apply to their copies of the codebase, keeping it moving forward towards a common goal.

It would seem apparent that there exist "better" and "worse" ways of creating, describing, and otherwise talking about these individual changes, but actually nailing down a consensus definition of "good" or "best" is often tricky. What follows here is one experienced developer's opinion of why it matters and what "good" means, along with some links to back that up.

Contents

  1. Terminology
  2. Branch Strategy
  3. Smaller, Patch-ier Changes
ericfischer@dhcp-18-189-94-159:~/scripts$ cat docker_destroy_all.sh
#!/bin/bash
# Stop all containers
docker stop $(docker ps -a -q)
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
# Delete all volumes
docker volume rm -f $(docker volume ls -q)
@efischer19
efischer19 / r.js failure
Created January 10, 2018 16:28
devstack log
DOCKER_COMPOSE_FILES="-f docker-compose.yml -f docker-compose-host.yml" ./provision.sh
+ RED='\033[0;31m'
+ GREEN='\033[0;32m'
+ YELLOW='\033[0;33m'
+ NC='\033[0m'
+ docker-compose up -d mysql mongo
Creating volume "devstack_edxapp_lms_assets" with default driver
Creating volume "devstack_mysql_data" with default driver
Creating volume "devstack_edxapp_studio_assets" with default driver
Creating volume "devstack_discovery_assets" with default driver
- clone edx/edx-proctoring into the ../src/ directory (relative to devstack)
- do the following twice, once in lms-shell and once in studio-shell:
- modify lms.env.json, the value for ENABLE_SPECIAL_EXAMS needs to be true (does not persist, will revert once you stop your container)
- modify cms.env.json, the value for ENABLE_SPECIAL_EXAMS needs to be true (does not persist, will revert once you stop your container)
- pip install -e /edx/src/edx-proctoring/ (might persist across container restarts, not sure, Leaning no)
- quit the shell, then `make (lms|studio)-restart` to restart the main django process.
- now, navigate to http://localhost:18010/settings/advanced/course-v1:edX+DemoX+Demo_Course in your browser (obvi, use a different course if needed)
- set "Enable Proctored Exams" and "Enable Timed Exams" to true there
- now we need to do stuff on an admin menu.
- do this if you've never created an admin user
@efischer19
efischer19 / all_the_things.sh
Last active September 22, 2017 13:54
Developing the assets page with studio-frontend
#!/bin/bash
# the "big hammer", kills any docker instances dead
sh ~/scripts/docker_destroy_all.sh
# delete *everything* I've been working on - it's all checked in right?
rm -rf ~/work/*
cd ~/work
sh ~/scripts/studio_frontend_development_env.sh
@efischer19
efischer19 / ffl_schedule.py
Last active September 4, 2017 18:22
Generating fantasy football schedules for the year
"""Output after running:
eric@oudebier:~/Desktop$ python ffl_schedule.py
Rando pairings: [('Zim', 'Td'), ('Kenny', 'Fish'), ('Jason', 'Steve'), ('Kyle', 'Brett'), ('Zane', 'Collin')]
In-division week 1: [('Td', 'Zim'), ('Jason', 'Zane'), ('Kenny', 'Kyle'), ('Brett', 'Collin'), ('Fish', 'Steve')]
In-division week 2: [('Fish', 'Kenny'), ('Kyle', 'Zane'), ('Jason', 'Zim'), ('Collin', 'Td'), ('Brett', 'Steve')]
In-division week 3: [('Jason', 'Steve'), ('Kyle', 'Zim'), ('Kenny', 'Zane'), ('Collin', 'Fish'), ('Brett', 'Td')]
In-division week 4: [('Brett', 'Kyle'), ('Jason', 'Kenny'), ('Zane', 'Zim'), ('Fish', 'Td'), ('Collin', 'Steve')]
In-division week 5: [('Collin', 'Zane'), ('Kenny', 'Zim'), ('Jason', 'Kyle'), ('Steve', 'Td'), ('Brett', 'Fish')]
Out-of-division week 1: [('Kenny', 'Td'), ('Jason', 'Fish'), ('Kyle', 'Steve'), ('Zane', 'Brett'), ('Zim', 'Collin')]
Out-of-division week 2: [('Jason', 'Td'), ('Kyle', 'Fish'), ('Zane', 'Steve'), ('Zim', 'Brett'), ('Kenny', 'Collin')]
#!/usr/bin/python
# -*- coding: utf-8 -*-
[
{u'time': u'0.004',
u'sql': u'SELECT `submissions_submission`.`id`, `submissions_submission`.`uuid`, `submissions_submission`.`student_item_id`, `submissions_submission`.`attempt_number`, `submissions_submission`.`submitted_at`, `submissions_submission`.`created_at`, `submissions_submission`.`raw_answer`, `submissions_submission`.`status` FROM `submissions_submission` WHERE (`submissions_submission`.`id` <= 7 AND `submissions_submission`.`id` >= 0) ORDER BY `submissions_submission`.`submitted_at` DESC, `submissions_submission`.`id` DESC'
},
{u'time': u'0.000',
u'sql': u"UPDATE `submissions_submission` SET `uuid` = '3fca942d09da41da92c1879851b1c512' WHERE `submissions_submission`.`id` = 7"
},
{u'time': u'0.000',
@efischer19
efischer19 / gist:b59802e853241c48cc2816cfff49f5d1
Last active August 7, 2017 15:05
Install dev branch of proctoring in sandbox
sudo vim /edx/app/edxapp/edx-platform/requirements/edx/github.txt
# comment out the edx-proctoring line, so it doesn't get re-installed on top of you
sudo su edxapp -s /bin/bash
cd
cd edx-platform
source ../edxapp_env
pip uninstall edx-proctoring -y
pip install git+https://github.com/edx/edx-proctoring.git@your_branch_name#egg=edx-proctoring==0.18.2
exit
@efischer19
efischer19 / LMS diff
Created July 26, 2017 20:15
Memory dump debugging
dict, 144002424 to 64600208, diff: -79402216, 55.1394995962%
unicode, 31903600 to 6837592, diff: -25066008, 78.5679609825%
TransformerDataMap, 6756400 to 0, diff: -6756400, 100.0%
str, 31529181 to 25779986, diff: -5749195, 18.2345205859%
list, 14326176 to 8664072, diff: -5662104, 39.5227868204%
TransformerData, 2657408 to 0, diff: -2657408, 100.0%
set, 3438584 to 1098936, diff: -2339648, 68.0410308429%
tuple, 6837360 to 4552008, diff: -2285352, 33.4244796237%
ReturnDict, 1525776 to 0, diff: -1525776, 100.0%
function, 7609440 to 6513720, diff: -1095720, 14.3994827477%
@efischer19
efischer19 / type_size_diff.out
Created July 26, 2017 14:21
Comparison of large dump against small, size deltas of given types
dict, 521597608 to 71847848, diff: -449749760, 86.2254260951%
unicode, 204969204 to 8713716, diff: -196255488, 95.7487681906%
ObjectId, 22841784 to 217000, diff: -22624784, 99.0499866385%
str, 47456524 to 27408451, diff: -20048073, 42.2451357794%
BlockKey, 19437480 to 184320, diff: -19253160, 99.0517289278%
list, 25739104 to 9034048, diff: -16705056, 64.9014666556%
BlockData, 8778560 to 82688, diff: -8695872, 99.0580687493%
EditInfo, 8778560 to 82688, diff: -8695872, 99.0580687493%
datetime.datetime, 7403424 to 425184, diff: -6978240, 94.2569276054%
int, 8518392 to 5261424, diff: -3256968, 38.23454004%