Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am robhudson on github.
  • I am robhudson (https://keybase.io/robhudson) on keybase.
  • I have a public key whose fingerprint is DF16 E9C0 8A36 2DC6 6A66 13DE 2FFA 51D3 C838 C55B

To claim this, I am signing this object:

@robhudson
robhudson / settings.json
Created January 3, 2019 19:51
vscode settings
{
"docker.showExplorer": false,
"editor.folding": false,
"editor.fontFamily": "Monaco, Consolas, 'Courier New', monospace",
"editor.fontLigatures": true,
"editor.formatOnPaste": true,
"editor.multiCursorModifier": "ctrlCmd",
"editor.renderControlCharacters": true,
"editor.renderIndentGuides": false,
"editor.renderLineHighlight": "all",
import random
from pyspark.sql.window import Window
from pyspark.sql.functions import cume_dist, row_number
raw_data = [(random.randint(1, 100),) for i in range(100)]
df = sqlContext.createDataFrame(raw_data, ['bin'])
ws = Window.orderBy('bin')
cdf = df.select(df['bin'], cume_dist().over(ws).alias('c'), row_number().over(ws).alias('i'))
diff --git a/mkt/comm/views.py b/mkt/comm/views.py
index bec28fc..0979a14 100644
--- a/mkt/comm/views.py
+++ b/mkt/comm/views.py
@@ -1,6 +1,8 @@
import os
from django.conf import settings
+from django.core.files.storage import default_storage as storage
+from django.http import HttpResponseRedirect
diff --git a/mkt/developers/tests/test_views.py b/mkt/developers/tests/test_views.py
index 2a45e8b..4236443 100644
--- a/mkt/developers/tests/test_views.py
+++ b/mkt/developers/tests/test_views.py
@@ -130,7 +130,7 @@ class TestAppDashboard(AppHubTest):
def test_public_app(self):
app = self.get_app()
doc = pq(self.client.get(self.url).content)
- item = doc('.item[data-addonid=%s]' % app.id)
+ item = doc('.item[data-addonid="%s"]' % app.id)
Traceback (most recent call last):
File "/home/vagrant/src/kuma/search/tests/test_views.py", line 147, in test_tokenize_camelcase_titles
response = self.client.get('/en-US/search?q=' + q)
File "/home/vagrant/src/vendor/src/django/django/test/client.py", line 439, in get
response = super(Client, self).get(path, data=data, **extra)
File "/home/vagrant/src/vendor/src/django/django/test/client.py", line 244, in get
return self.request(**r)
File "/home/vagrant/src/vendor/src/django/django/test/client.py", line 381, in request
response = self.handler(environ)
File "/home/vagrant/src/vendor/src/django/django/test/client.py", line 84, in __call__
{
"highlight": {
"fields": {
"content": {},
"summary": {}
},
"order": "score"
},
"facets": {
"marketplace": {
(env)vagrant@precise32:~/src$ pip install --no-deps -U -t vendor/src/elasticsearch-dsl-py -e git+https://github.com/elasticsearch/elasticsearch-dsl-py.git@ea37a0dcefb0f3738a9796a5095f3d93796df259#egg=elasticsearch-dsl-py
You are using pip version 6.0.6, however version 6.0.7 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Obtaining elasticsearch-dsl-py from git+https://github.com/elasticsearch/elasticsearch-dsl-py.git@ea37a0dcefb0f3738a9796a5095f3d93796df259#egg=elasticsearch-dsl-py
Updating /home/vagrant/env/src/elasticsearch-dsl-py clone (to ea37a0dcefb0f3738a9796a5095f3d93796df259)
Could not find a tag or branch 'ea37a0dcefb0f3738a9796a5095f3d93796df259', assuming commit.
/home/vagrant/env/lib/python2.6/site-packages/setuptools/dist.py:284: UserWarning: The version specified requires normalization, consider using '0.0.4.dev0' instead of '0.0.4.dev'.
self.metadata.version,
/home/vagrant/env/lib/python2.6/site-packages/pkg_resources/__init__.py:2263:
mysql> select a.app_slug, ai.value from addons_installs as ai join addons as a on a.id=ai.addon_id where region=0 order by value desc limit 20;
+---------------------+--------+
| app_slug | value |
+---------------------+--------+
| connecta2 | 254311 |
| openwapp | 184414 |
| facebook-1 | 153012 |
| loqui | 115818 |
| whatsapp-firefox-os | 70816 |
| line | 43606 |
@robhudson
robhudson / feed.py
Created July 1, 2014 22:53
Feed experiment
import datetime
from elasticsearch import Elasticsearch
INDEX = 'feed'
today = datetime.date.today()
es = Elasticsearch()