Skip to content

Instantly share code, notes, and snippets.

View gist:9743631
### Keybase proof
I hereby claim:
* I am aconbere on github.
* I am anders (https://keybase.io/anders) on keybase.
* I have a public key whose fingerprint is B3CB AC64 FF6E F86D C4FA 5E58 0F5A 56CD 5DE9 07B5
To claim this, I am signing this object:
View gist:9550965
2014-03-14T12:06:54.871918+00:00 app[worker.1]: resolve_fast_staging.py/job ERROR Failed: resolving remainging rows in fast staging
2014-03-14T12:06:54.871918+00:00 app[worker.1]: Traceback (most recent call last):
2014-03-14T12:06:54.871918+00:00 app[worker.1]: "fast_events_master"))
2014-03-14T12:06:54.871918+00:00 app[worker.1]: File "/app/upworthyetl/__init__.py", line 25, in error_handling
2014-03-14T12:06:54.871918+00:00 app[worker.1]: File "/app/upworthyetl/resolve_fast_staging.py", line 20, in job
2014-03-14T12:06:54.871918+00:00 app[worker.1]: InternalError: 1023
2014-03-14T12:06:54.871918+00:00 app[worker.1]: yield
2014-03-14T12:06:54.873387+00:00 app[worker.1]: Process resolve_fast_staging.py/job:
2014-03-14T12:06:54.871918+00:00 app[worker.1]:
2014-03-14T12:06:54.873529+00:00 app[worker.1]: File "/app/.heroku/python/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
@aconbere
aconbere / gist:5543199
Created May 8, 2013
find the big files... dammit
View gist:5543199
find . -type f | xargs du -h | sort -h
View gist:5188516

As software developers we use datastructures all the time Linked Lists, Hash Maps, Stacks. Most datastructures have a set of related operations that we can think of as the core pieces that define that structure in Scala we call the collection of those operations a Trait on in Java an Interface. A Hash Map exposes the Map interface and has an operations to add a key and value +, remove a key -, retrieve the value at key get and an operation like fold to operate over the List of keys and values.

We have certain expectations of these datastructures from our experiences, we expect Maps to be hash maps, and we expect queues to be stacks. But there's no law that requires that. A common replacement of as Hash Map is a Tuple List,

@aconbere
aconbere / semi-groups-irc.mkd
Last active Jul 11, 2022
Abstract algebra applied to totally boring programming problems
View semi-groups-irc.mkd

The semigroup, or how a bunch of math snuck into my program

This is a story about an idea, an abstraction if you will. As software developers we deal in abstractions constantly, but I want to talk to you about one particular idea, the idea of +. Addition is pretty fundamental as a concept, so let's run through the basics. You'll be familiar with some common forms of addition like integer addition 1 + 2 = 3 and rational addition 1/2 + 2/3 = 7/6. But what does it mean to be able to add something? Could we add functions? What about optional values?

One answer to that question is provided by algebra a lot of algebra is spent defining sets of things and what operations can be performed on them. And what algebra will tell us is that the things we tend to think of as being addable are generally called Semigroups. A Semigroup is a set where all items in the set can be added together so that for every a, b, and c in the set (a + b) + c = a + (b + c). I

View gist:3076815
DBus failure! This is most likely caused by the wicd daemon stopping while wicd-curses is running. Please restart the daemon, and then restart wicd-curses.
Traceback (most recent call last):
File "/usr/share/wicd/curses/wicd-curses.py", line 921, in call_update_ui
self.update_ui(True)
File "/usr/share/wicd/curses/wicd-curses.py", line 88, in wrapper
return func(*args, **kargs)
File "/usr/share/wicd/curses/wicd-curses.py", line 932, in update_ui
self.handle_keys(input_data[1])
File "/usr/share/wicd/curses/wicd-curses.py", line 913, in handle_keys
self.diag.save_settings()
View gist:3040875
DBus failure! This is most likely caused by the wicd daemon stopping while wicd-curses is running. Please restart the daemon, and then restart wicd-curses.
Traceback (most recent call last):
File "/usr/share/wicd/curses/wicd-curses.py", line 921, in call_update_ui
self.update_ui(True)
File "/usr/share/wicd/curses/wicd-curses.py", line 88, in wrapper
return func(*args, **kargs)
File "/usr/share/wicd/curses/wicd-curses.py", line 932, in update_ui
self.handle_keys(input_data[1])
File "/usr/share/wicd/curses/wicd-curses.py", line 913, in handle_keys
self.diag.save_settings()
View gist:2500766
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/django/core/handlers/base.py", line 101, in get_response
request.path_info)
File "/usr/lib/pymodules/python2.7/django/core/urlresolvers.py", line 252, in resolve
sub_match = pattern.resolve(new_path)
File "/usr/lib/pymodules/python2.7/django/core/urlresolvers.py", line 158, in resolve
return ResolverMatch(self.callback, args, kwargs, self.name)
File "/usr/lib/pymodules/python2.7/django/core/urlresolvers.py", line 164, in _get_callback
self._callback = get_callable(self._callback_str)
File "/usr/lib/pymodules/python2.7/django/utils/functional.py", line 124, in wrapper
@aconbere
aconbere / gist:971936
Created May 14, 2011
testing node-fake
View gist:971936
fake = require("fake")
var namespace = { x: function () { this.whatever = "skimpy" } }
fakeX = fake.create()
fakeX.expects(namespace, "X")
.andReturns("AASDFASDF")
var y = new namespace.X()
assert.equal(y, "AASDFASDF")
View gist:910760
package com.conbere.anders.escape;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.SurfaceView;
import android.view.SurfaceHolder;