Skip to content

Instantly share code, notes, and snippets.

View vegitron's full-sized avatar

Patrick Michaud vegitron

  • University of Washington
View GitHub Profile
@vegitron
vegitron / gist:014e63c89a6418f970e2
Created February 27, 2015 00:38
Canvas error in myuw tests
(myuw)pmichaud@anise:~/django/myuw$ python manage.py test myuw_mobile.test.dao.canvas.TestCanvas
Creating test database for alias 'default'...
EE
======================================================================
ERROR: test_crosslinks (myuw_mobile.test.dao.canvas.TestCanvas)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pmichaud/django/myuw/myuw_mobile/test/dao/canvas.py", line 13, in test_crosslinks
data = get_indexed_data_for_regid("12345678901234567890123456789012")
File "/home/pmichaud/django/myuw/myuw_mobile/dao/canvas.py", line 41, in get_indexed_data_for_regid
use Solstice::Factory::Person;
use ShareSpace::Factory::Space;
use Data::Dumper;
use JSON;
my $username = $ARGV[0];
my $user = Solstice::Factory::Person->new()->getByLogin($username);
my $list = $user->getLoginRealm()->getAccountsPersonHasAccessTo($user);
@vegitron
vegitron / deploy.yml
Created July 22, 2015 17:44
new django-managed-deploy-git-base.yml
- hosts: django-app-server
roles:
- { role: "django_app_server_role" }
vars:
build_name: "{{ inventory_file }}"
current_build_value: "{{ lookup('current_build', build_name) }}"
files_dir: "{{ lookup('env', 'ANSIBLE_FILES')|default('/data/ansible/aca-builds/files', true) }}"
acting_user: "{{ lookup('env', 'USER') }}"
- hosts: mysql-db-server
diff --git a/myuw/static/js/myuw_log.js b/myuw/static/js/myuw_log.js
index 90158e6..f1850e7 100644
--- a/myuw/static/js/myuw_log.js
+++ b/myuw/static/js/myuw_log.js
@@ -263,9 +263,11 @@ var LogUtils = {
},
get_all_cards: function(){
+ console.log("------------ Setting card, with positions");
var cards = [],
pmichaud@vegitron:~/ansible/testing$ cat time-demo.yml
- name: a playbook demonstrating eval on use for lookups
hosts: all
vars:
time_in_ms: "{{ lookup('pipe', 'echo $(($(date +%s%N)/1000000))') }}"
tasks:
- debug: msg = "Time - {{ time_in_ms }}"
@vegitron
vegitron / gist:7104494
Created October 22, 2013 17:16
Attempting to assign and use ansible facts.
pmichaud@vegitron:~/ansible/testing$ cat fact-test.yml
- name: a playbook trying out set_fact
hosts: all
tasks:
- set_fact:
value1: "Static Value"
value2: "{{ lookup('pipe', 'echo $(($(date +%s%N)/1000000))') }}"
- debug: msg = "Time - {{ value1 }}"
- debug: msg = "Time - {{ value2 }}"
bash-3.2$ time echo "hello" | sleep 2
real 0m2.003s
user 0m0.001s
sys 0m0.002s
bash-3.2$ echo "ok" | time echo "hello" | sleep 2
0.00 real 0.00 user 0.00 sys
bash-3.2$
import re
import sys
class BFBuild(object):
byte_var_table = {}
current_var_index = 0
python = ""
def __init__(self, python):
self.python = python
diff --git a/playbooks/includes/django-managed-post-checkout.yml b/playbooks/includes/django-managed-post-checkout.yml
index 9110c0d..a268dd9 100644
--- a/playbooks/includes/django-managed-post-checkout.yml
+++ b/playbooks/includes/django-managed-post-checkout.yml
@@ -16,7 +16,7 @@
when: pip_upgrades_files is defined
- name: Install requirements with pip. May (probably will) take a while
- shell: source {{ base_dir }}/builds/{{current_build_value}}/bin/activate && PIP_ACCEL_CACHE={{ pip_accel_cache_dir }} pip-accel install -r {{ base_dir }}//builds/{{current_build_value}}/{{ item }} -i {{ pypi_mirror | default("https://pypi.s.uw.edu/root/pypi/+simple") }}
+ shell: source {{ base_dir }}/builds/{{current_build_value}}/bin/activate && cd {{ base_dir }}/builds/{{current_build_value}} && PIP_ACCEL_CACHE={{ pip_accel_cache_dir }} pip-accel install -r {{ base_dir }}//builds/{{current_build_value}}/{{ item }} -i {{ pypi_mirror | default("https://pypi.s.uw.edu/root/pypi/+simple"
@vegitron
vegitron / slow_server.py
Created January 5, 2017 16:29
A server that bypasses httplib's timeout
import BaseHTTPServer
import SocketServer
import time
class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(s):
s.send_response(200)
s.send_header("Content-type", "text/html")
s.end_headers()
for i in range(100):