(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
from django.http import HttpResponse | |
from tastypie import http | |
from tastypie.exceptions import ImmediateHttpResponse | |
from tastypie.resources import convert_post_to_put | |
class PublicEndpointResourceMixin(object): | |
""" Public endpoint dispatcher, for those routes upon which you don't want | |
to enforce the current resources authentication limits.""" |
class ProfileResource(ModelResource): | |
user = fields.ForeignKey(UserResource, 'user') | |
def prepend_urls(self): | |
urls = [ | |
url(r'^(?P<resource_name>%s)/(?P<username>[\w\d_.-]+)/$' %\ | |
self._meta.resource_name, self.wrap_view('user_by_username'), | |
name='profile_user_by_username') | |
] | |
return urls |
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
''' | |
AWS S3 Gzip compression utility | |
Author: Dmitriy Sukharev | |
Modified: 2013-09-11 | |
------- | |
Synchronizes directory with gzipped content of Amazon S3 bucket with local |
SELECT json_build_object( | |
'total', (SELECT n_live_tup FROM pg_stat_user_tables WHERE relname='sometable'), | |
'count', count(sometable_rows.*), | |
'offset', 0, | |
'results', json_agg(row_to_json(sometable_rows)) | |
) | |
FROM (SELECT * FROM test_log_clj) | |
ORDER BY "time" | |
LIMIT 10 OFFSET 0) | |
sometable_rows; |
server { listen 80; | |
server_name example.com; | |
access_log /var/log/example.com/nginx.access.log; | |
error_log /var/log/example.com/nginx.error.log; | |
root /var/www/apps/example.com/public; | |
charset utf-8; | |
location / { | |
rewrite ^ https://$host$request_uri? permanent; | |
} |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
layout | title | date | categories | crossposted |
---|---|---|---|---|
post |
How I learned Clojure while solving easy coding challenges |
2015-08-03 |
coding |
logdown |
I decided to learn Clojure (and therefore ClojureScript, since the two intersect significantly) by doing. Who'd ever blame me with that?
Scalr | |
http://highscalability.com/blog/2010/3/22/7-secrets-to-successfully-scaling-with-scalr-on-amazon-by-se.html | |
http://stackoverflow.com/questions/10061843/how-to-convert-linux-cron-jobs-to-the-amazon-way | |
Cron Jobs Are Hard To Distribute | |
Watch out when scaling out instances with cron jobs on them. Cron jobs aren't designed for the cloud. If the machine image holding your cron job scales out to 20 instances, your cron job will be executed 20 times more often. | |
This is fine if the scope of your cron job is limited to the instance itself, but if the scope is larger, the above becomes a serious problem. And if you single out a machine to run those cron jobs, you run the risk of not having it executed if that machine goes down. |