Skip to content

Instantly share code, notes, and snippets.

Steve Pike stringfellow

Block or report user

Report or block stringfellow

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@stringfellow
stringfellow / problem.md
Last active Aug 8, 2018
Celery hang problem
View problem.md

Celery 4.1.0, Redis client 2.10.6, Redis server 4.0

I have a problem that seems to be related to synchronous subtasks, except that none of the workarounds (or indeed the errors/warnings that I should expect from the docs) are having any effect.

I have 3 worker servers, A B and C

  • A and B run the same codebase.
  • A calls apply_async of a Task1. Get/Forget not called (it doesn't care about the result itself, but we want the result stored in the backend)
  • Task1 gets run by server B.
  • Within Task1 (now executed on server B) - Task2 from another codebase is called - using send_task (since the codebase is not shared here).
View keybase.md

Keybase proof

I hereby claim:

  • I am stringfellow on github.
  • I am stringfellow (https://keybase.io/stringfellow) on keybase.
  • I have a public key ASDXUKQ063VHceGQE6EEdI1OX86qMYngre_FK_7K5eqnnQo

To claim this, I am signing this object:

@stringfellow
stringfellow / slinear vs linear
Last active Sep 7, 2018
linear & slinear interpolation of constant data
View slinear vs linear
pandas slinear: [60.0, 60.0, 60.0, 60.0, 59.999999999999993, 60.0, 60.0, 60.0]
pandas linear: [60.0, 60.0, 60.0, 60.0, 60.0, 60.0, 60.0, 60.0]
scipy slinear: [60.0, 60.0, 60.0, 60.0, 59.999999999999993, 60.0, 60.0, 60.0]
scipy linear: [60.0, 60.0, 60.0, 60.0, 60.0, 60.0, 60.0, 60.0]
F
======================================================================
FAIL: Proof that linear and slinear are not equal.
----------------------------------------------------------------------
Traceback (most recent call last):
File "....", line 329, in test_slinear_versus_linear
@stringfellow
stringfellow / stacked_area_hover.py
Created Oct 10, 2016
Showing how to make a Bokeh stacked area with hover labels per-series
View stacked_area_hover.py
def stacked_area(df, colours, series_noun, **kwargs):
"""Return a stacked area plot."""
columns = df.columns
areas = stacked(df, columns)
x2 = np.hstack((df.index[::-1], df.index))
p = figure(
width=900, height=600, tools=[
SaveTool(),
HoverTool(tooltips=[(series_noun, "@name")])
@stringfellow
stringfellow / middleware.py
Created Mar 17, 2016
Simple Django profiling middleware
View middleware.py
# -*- coding: utf-8 -*-
import cProfile
import pstats
from django.conf import settings
class ProfileStatsMiddleware(object): # pragma: no cover
"""Super light-weight cProfile/pstats profile middleware."""
View ebay_sold_averagerer.js
x=y=0;$('.bidsold').each(function(){x++;y+=parseFloat($(this).html().trim().substr(1,5))});y/x;
View mapproxy.bat
call "C:\OSGeo4w64\bin\o4w_env.bat"
IF NOT EXIST C:\mapproxy (
easy_install virtualenv
mkdir C:\mapproxy
cd C:\mapproxy
virtualenv --system-site-packages env
env\Scripts\activate
pip install pyreadline MapProxy ipython lxml
mapproxy-util create -t base-config mapactionproxy
cd mapactionproxy
@stringfellow
stringfellow / silence_if_ok.sh
Created Jul 12, 2012
Bash wrapper script to silence cron if there are no errors, and print out if there are
View silence_if_ok.sh
#!/bin/bash
logfile=$$.log
exec 6>&1
exec > $logfile 2>&1
$*
RETVAL=$?
exec 1>&6 6>&-
if [ $RETVAL -ne 0 ]; then
echo "FAILURES:"
cat $logfile
@stringfellow
stringfellow / spine_modelresource.py
Created May 18, 2012
Spinejs - django-tastypie integration base ModelResource class
View spine_modelresource.py
#!/usr/bin/env python
# -*- coding: iso-8859-15 -*-
from tastypie.resources import ModelResource
class SpineFrontedResource(ModelResource):
"""A base model resource for spine-fronted models.
* Bins the 'id' that spine sends.
* Removes 'meta' from the list, returns only objects.
@stringfellow
stringfellow / tms2osm.py
Created May 11, 2012
TMS to OSM directory conversion script
View tms2osm.py
import os
import shutil
import argparse
import commands
from datetime import datetime
try:
import progressbar as pb
except ImportError:
You can’t perform that action at this time.