Skip to content

Instantly share code, notes, and snippets.

View daaray's full-sized avatar

David Ray daaray

  • Grove Collaborative
  • Chapel Hill, NC
View GitHub Profile
for x in range(1 - end):
choices = []
for y in [y-1, y, y+1]:
choices.append({
'x': x, 'y': y, 'delta': abs(elevation - self.matrix[y][x])
})
min_delta = min([choice['delta'] for choice in choices])
next_step = next((item for item in choices if item['delta'] == min_delta), None)
@daaray
daaray / matrix.py
Last active October 19, 2019 01:48
def topo_generator(min_elev, max_elev, width, height):
matrix = []
for y in range(0, height):
matrix.append([])
for x in range(0, width):
matrix[y].append(random.randrange(min_elev, max_elev))
return matrix
def topo_generator(min_e, max_e, width, height):
matrix = []
daaray~/Devel/otscout-ui ☞ yarn hot_pack
yarn hot_pack v0.24.6
$ cd ./client && node webpack.hot.js --hotPack
(node:63085) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'outputPath' of undefined
(node:63085) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
>>> [x.file.path for x in models.Rendition.objects.all()]
['/app/media/images/wagtail_sproing_by_Jim_Bendon.width-1000.jpg', '/app/media/images/wagtail_at_Borovoye_Kazakhstan_by_Ken_and_Nye.width-1000.jpg', '/app/media/images/David_Mitchell_by_Kubik.width-200.jpg', '/app/media/images/James_Joyce_in_1915.width-200.jpg', '/app/media/images/wagtail_collects_insects_by_Maggi_94.width-200.jpg', '/app/media/images/wagtail_by_fs-phil.width-200.jpg', '/app/media/images/pied_wagtail_by_Marie_Hale.width-200.jpg', '/app/media/images/wagtail_by_joe_buckingham.width-200.jpg', '/app/media/images/James_Joyce_in_1915.width-300.jpg', '/app/media/images/wagtail_collects_insects_by_Maggi_94.max-165x165.jpg', '/app/media/images/wagtail_sproing_by_Jim_Bendon.max-165x165.jpg', '/app/media/images/wagtail_at_Borovoye_Kazakhstan_by_Ken_and_Ny.max-165x165.jpg', '/app/media/images/pied_wagtail_by_Marie_Hale.max-165x165.jpg', '/app/media/images/white_wagtail_by_Koshyk.max-165x165.jpg', '/app/media/images/wagtail_by_fs-phil.max-165x165.j

Keybase proof

I hereby claim:

  • I am daaray on github.
  • I am daaray (https://keybase.io/daaray) on keybase.
  • I have a public key whose fingerprint is 979F AD9D CDB1 C83E D5DC 9435 6A44 3A20 F13F 0123

To claim this, I am signing this object:

@daaray
daaray / sentinel.conf
Created August 16, 2013 15:28
Minimum configuration for using Redis Sentinel in a local development environment.
port 26379 # or a custom port
sentinel monitor redis-Redis1 127.0.0.1 6379 2
sentinel down-after-milliseconds redis-Redis1 60000
sentinel failover-timeout redis-Redis1 900000
sentinel can-failover redis-Redis1 yes
sentinel parallel-syncs redis-Redis1 1
{% with foo="http:://domain.com"|add:STATIC_URL|add:"path/to/image.jpg" %}
{{ foo }}
{% endwith %}
@daaray
daaray / clear_cache
Created April 5, 2012 15:25
Clear Django Cache
from django.core.cache import cache
cache._cache.flush_all()