Skip to content

Instantly share code, notes, and snippets.

View drj11's full-sized avatar

David Jones drj11

View GitHub Profile
@drj11
drj11 / iterwat.py
Created April 13, 2016 20:44
Produces wrong error in Python 3
#!/usr/bin/env python3
def it():
x=1
yield 1
"{:d}".format(x.bit_length) # try changing to assert 0
yield 2
print(max(*it()))
from __future__ import print_function
class S():
_ = print("executing class S")
x = 1
y = x
print("S.y", S.y)
try:
@drj11
drj11 / codecafe.md
Last active March 10, 2016 15:26
R code cafe notes

no-one is using the etherpad.

by 1745 (15 minutes in) some people had made a plot, most people downloading and installing.

by 1800 (30 minutes in), many people have a plot.

installing on arch and gentoo is hard (arch user gave up installing Rstudio and used command line; gentoo user had to use VNC!). Installing on Ubuntu was hard too.

Someone asked "what does pch=1 do?" (in the call to legend)

2016-02-18
Feedback for CICS course "Help I need to use R"
That is a terrifying amount of weight to put on a USB pen drive.
When explaining «setwd("U:\\R - course")» instructor swapped backslash and forward slash.
And repeated it.
So this is not an isolated incident.
Confusion on library. For me on Ubuntu, just «library(psych)» works. No need to use second argument.
@drj11
drj11 / gist:d66c78ea55954d6e6fd0
Created February 3, 2016 11:53
vagrant provision broken
drj@mus:~/prj/refinery-platform$ vagrant provision
==> default: Running provisioner: shell...
default: Running: inline script
==> default: stdin: is not a tty
==> default: WARNING: $GALAXY_DATABASE_DIR is not set: copying files from local Galaxy instance will not work.
==> default: Running provisioner: shell...
default: Running: /tmp/vagrant-shell20160203-7267-75tc0j.sh
==> default: stdin: is not a tty
==> default: Reading package lists...
==> default: Building dependency tree...
# With "unamed expressions"
x = 1 + 2 + 3 + 4
# Without:
x = 1
x += 2
x += 3
x += 4
@drj11
drj11 / gist:f166cae63e846ba6370d
Created January 28, 2016 11:08
close over unassigned variable
def box(x):
if x:
a = x
def f():
return a
return f
gives1 = box(1)
print(gives1())
explodes = box(0)
a = ['hello']
b = a
def f(x):
pass
# anything you like here
f(a)
print(a is b)
@drj11
drj11 / gist:a166dc235259b1a26ca0
Last active December 21, 2015 15:19
Clegg 2015-12-21
[I asked Nick Clegg to support EDM 660 http://www.parliament.uk/edm/2015-16/660]
Clegg's reply:
I have not been in the practice of signing Early Day Motions for
many years now; in fact, I was precluded from doing so whilst I
was in Government. Although Early Day Motions have their place,
I have found from experience that they are not always the most
effective tool to bring about the change that is sought. I
personally think it’s far more effective to contact Ministers
@drj11
drj11 / 2015-12-08-minutes.md
Last active December 8, 2015 16:54
2015-12-08 Sheffield Software Carpentry

Minutes

We will get TUOS to be an Affiliate supporter of Software Carpentry (http://software-carpentry.org/scf/membership.html). @walkingrandomly to act.

We will hold a Data Carpentry course first, then plan 2 more (Software Carpentry) courses.

1st course to be held in March ish. Check Semester / PhD program dates. @annakystalli to find out the PhD program dates.