Skip to content

Instantly share code, notes, and snippets.

["_at", index: 6, input: "_start_at"]
@alexmuller
alexmuller / grouped_timeseries_update.py
Created October 30, 2014 10:34
Grouped timeseries with added "count"
from stagecraft.apps.dashboards.models.module import ModuleType
grouped_timeseries = ModuleType.objects.get(name='grouped_timeseries')
new_json = {u'definitions': {u'axis': {u'type': u'object', u'properties': {u'label': {u'required': True, u'type': u'string'}, u'key': {u'oneOf': [{u'type': u'string'}, {u'type': u'array'}], u'required': False}, u'format': {u'oneOf': [{u'type': u'string'}, {u'type': u'object', u'properties': {u'type': {u'type': u'string'}}}]}}}}, u'$schema': u'http://json-schema.org/draft-03/schema#', u'allOf': [{u'definitions': {u'query-params': {u'type': u'object', u'properties': {u'start_at': {u'required': False, u'type': u'string'}, u'period': {u'allOf': [{u'required': False}, {u'enum': [u'hour', u'day', u'week', u'month', u'quarter'], u'type': u'string'}]}, u'filter_by': {u'items': {u'type': u'string'}, u'required': False, u'type': u'array'}, u'collect': {u'items': {u'pattern': u':(sum|mean|set|count)$', u'type': u'string'}, u'required': False, u'type': u'array'}, u'group_by': {u'oneOf':
{
"entrypoint": "performanceplatform.collector.webtrends.reports",
"data-set": {
"data-group": "foo",
"data-type": "bar"
},
"query": {
"report_id": "alphanumeric-string"
},
"options": {
Ubuntu 12.04.2 LTS
Ubuntu 12.04.2 LTS
Welcome to Ubuntu 12.04.2 LTS (GNU/Linux 3.2.0-70-virtual x86_64)
* Documentation: https://help.ubuntu.com/
84 packages can be updated.
0 updates are security updates.
New release '14.04.1 LTS' available.
@alexmuller
alexmuller / index.markdown
Last active August 29, 2015 14:11
Converting the `user_satisfaction_graph` to use transforms

Converting the user_satisfaction_graph to use transforms

Raw datum that we store:

{
  "_day_start_at": "2014-03-10T00:00:00+00:00",
  "_hour_start_at": "2014-03-10T00:00:00+00:00",
  "_id": "20140310_apply-carers-allowance",
 "_month_start_at": "2014-03-01T00:00:00+00:00",
{"trim": false, "value-attribute": "rating", "axis-period": "month"}
{
"data": [
{
"_day_start_at": "2014-04-07T00:00:00+00:00",
"_end_at": "2014-04-14T00:00:00+00:00",
"_hour_start_at": "2014-04-07T00:00:00+00:00",
"_id": "MjAxNC0wNC0wN1QwMDowMDowMCswMDowMF8yMDE0LTA0LTE0VDAwOjAwOjAwKzAwOjAw",
"_month_start_at": "2014-04-01T00:00:00+00:00",
"_quarter_start_at": "2014-04-01T00:00:00+00:00",
"_start_at": "2014-04-07T00:00:00+00:00",
@alexmuller
alexmuller / git-commit.md
Created January 2, 2015 23:11
My vim cheat sheet
  • Split the window: ctrl + w, s
  • Move between splits ctrl + w, ctrl + w
  • Page down: ctrl + f
  • Page up: ctrl + b
@alexmuller
alexmuller / drone.md
Last active August 29, 2015 14:13
Drone examples
@alexmuller
alexmuller / header_method.rb
Last active August 29, 2015 14:13
A firebreak project to enable Content-Security-Policy on GOV.UK
def set_content_security_policy
asset_hosts = "http://static.dev.gov.uk http://assets-origin.dev.gov.uk"
default_src = "default-src 'none'"
script_src = "script-src #{asset_hosts} http://www.google-analytics.com 'unsafe-inline'"
style_src = "style-src #{asset_hosts} 'unsafe-inline'"
img_src = "img-src #{asset_hosts}"
report_uri = "report-uri http://www.dev.gov.uk:8080/e"
csp_header = "#{default_src}; #{script_src}; #{style_src}; #{img_src}; #{report_uri}"