Skip to content

Instantly share code, notes, and snippets.

View cpennington's full-sized avatar

Calen Pennington cpennington

View GitHub Profile
def foo(fn):
fn()
def bar():
print "bar"
>>> foo(bar)
bar
-- Merge a list of list by taking the first element of each list, then the second, and so on
merge :: [[a]] -> [a]
merge [] = []
merge ls = [head l | l <- ls, not $ null l] ++ (merge [tail l | l <- ls, not $ null l])
> ghc-pkg field Cabal-1.14.0 depends
depends: array-0.4.0.0-0b32f6f98c0297dbb0e5cfc0087bd1f0
base-4.5.0.0-f76ceb9607ba9bd4fcfb9c7b92d8cfe1
containers-0.4.2.1-7c54595400348f577b3b4a45691c5afd
directory-1.1.0.2-71fc9828e4f6545b839e07243053221f
filepath-1.2.0.1-e170ebdeb7278a289e12d3fb01f4c05a
old-time-1.1.0.0-681e9789e8750358e65a9448b60ba641
pretty-1.1.1.0-7e118fa87f5698f5c005fe87b34befe8
process-1.1.0.1-c50c4cf51a03eb87519e7fce980bbb47
[ 20121012 13:24:44 ] : !!! Parallel execution exception under host u'sandbox-edge-lms-preview-002.m.edx.org:22':
[ 20121012 13:24:44 ] : !!! Parallel execution exception under host u'sandbox-edge-cas-002.m.edx.org:22':
[ 20121012 13:24:44 ] : Traceback (most recent call last):
[ 20121012 13:24:44 ] : Traceback (most recent call last):
[ 20121012 13:24:44 ] : File "/usr/local/lib/python2.7/dist-packages/fabric/tasks.py", line 166, in inner
[ 20121012 13:24:44 ] : File "/usr/local/lib/python2.7/dist-packages/fabric/tasks.py", line 166, in inner
[ 20121012 13:24:44 ] : [ 20121012 13:24:44 ] : result = task.run(*args, **kwargs)
result = task.run(*args, **kwargs)
[ 20121012 13:24:44 ] : File "/usr/local/lib/python2.7/dist-packages/fabric/tasks.py", line 112, in run
[ 20121012 13:24:44 ] : File "/usr/local/lib/python2.7/dist-packages/fabric/tasks.py", line 112, in run
Traceback (most recent call last):
File "/home/cpennington/work/mitx/common/lib/xmodule/xmodule/modulestore/xml.py", line 301, in try_load_course
course_descriptor = self.load_course(course_dir, errorlog.tracker)
File "/home/cpennington/work/mitx/common/lib/xmodule/xmodule/modulestore/xml.py", line 418, in load_course
course_descriptor = system.process_xml(etree.tostring(course_data))
File "/home/cpennington/work/mitx/common/lib/xmodule/xmodule/modulestore/xml.py", line 156, in process_xml
self.course, xmlstore.default_class)
File "/home/cpennington/work/mitx/common/lib/xmodule/xmodule/x_module.py", line 642, in load_from_xml
return class_.from_xml(xml_data, system, org, course)
File "/home/cpennington/work/mitx/common/lib/xmodule/xmodule/course_module.py", line 207, in from_xml
@cpennington
cpennington / gist:4665578
Created January 29, 2013 16:31
Nginx try_files, regex location, and root
# config
# Check security on this
location ~ ^/static/(?P<file>.*)$ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/nginx.htpasswd;
root /opt/wwc;
try_files /staticfiles/$file /course_static/$file =404;
# return a 403 for static files that shouldn't be
vagrant@precise64:~/edx-platform$ docker run -dns 8.8.8.8 -i -t base /bin/bashroot@0186d6352a75:/# cat /etc/resolv.conf
nameserver 8.8.8.8
root@0186d6352a75:/# ping google.com
^C
root@0186d6352a75:/#
vagrant@precise64:~/edx-platform$ cat <(echo "FROM base"; for i in {1..40}; do echo "ENV var_${i} ${i}"; done) | docker build -
FROM base ()
===> b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc
ENV var_1 1 (b750fe79269d2ec9a3c593ef05b4332b1d1a02a62b4accb2c21d589ff2f5f2dc)
===> 38a12954fead78c1413f0b92da8a4b9e313cdcfcf4aa7b6c88b71d708d64dbdf
ENV var_2 2 (38a12954fead78c1413f0b92da8a4b9e313cdcfcf4aa7b6c88b71d708d64dbdf)
===> c9c263e4b126a0afebc1c20a45b1c6b238c7f4b0c2ae8e2089e77b22079ec24b
ENV var_3 3 (c9c263e4b126a0afebc1c20a45b1c6b238c7f4b0c2ae8e2089e77b22079ec24b)
===> 9e82add90abe1af49638b9c181b0110b9411aa81a9bf342605ff9c701b340453
ENV var_4 4 (9e82add90abe1af49638b9c181b0110b9411aa81a9bf342605ff9c701b340453)
dig (work=46fa8171) ~> dig registry.docker.io
; <<>> DiG 9.8.1-P1 <<>> registry.docker.io
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 56766
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;registry.docker.io. IN A
cabal: Could not resolve dependencies:
trying: zerorpc-haskell-0.1.0.0 (user goal)
next goal: stm (dependency of zerorpc-haskell-0.1.0.0)
rejecting: stm-2.4.2/installed-b5d... (conflict: zerorpc-haskell =>
stm>=2.4.3)
Dependency tree exhaustively searched.