Duolingo: The Next Chapter in Human Computation
Amazing idea by the founder behind ReCAPTCHA!
If Duolingo gets very popular the whole English Wikipedia could be translated in 80 hours by approximately 1 million people. There are currently 1.2 billion people trying to learn another language - the potential is definitely there!
It's a marathon and not a sprint
It does not matter what you do the next 2 weeks, but what you do the next 15 years. This is a marathon and not a sprint. We should focus on the long term and not the short term.
Overworking yourself for a few years and stressing over small things can easily lead to a burnout. Focusing on the superficial and easy things can be rewarding, but only for a little while. Achieving greatness requires many years of focused devotion where you focus on the big picture. Even a lot of research shows that there isn't an easy way to master anything. Researchers have shown it takes about ten years to develop expertise in any of a wide variety of areas, including chess playing, music composition, telegraph operation, painting, piano playing, swimming, tennis, and research in neuropsychology and topology... Read more about this in Teach Yourself Programming in Ten Years by Peter Norvig. If you are willing to spend 15 years on something your idea pool opens up and you can tackle much harder and more interesting problems. If you work 8 hours pr. weekday and do this for 15 years then it's 31.200 hours. Please spend it on something interesting and worthwhile! Finding Your Way as an Entrepreneur
Great talk by Dropbox co-founder Drew Houston [perma link at Standford]:
Programming is an art![]() We programmers have a bad reputation. The general thinking is that we are asocial robots that create code for computers to understand. I think we are artist and magicians that create something out of nothing. Programming is a creative process, it's an art and it's important to nourish our creativity! I have been thinking why I love programming and the bottom line is that I love creating stuff. I like to imagine how things can be. Using only a computer I can create anything I can imagine and I can easily share my creations with other people. It's not many professions that enable you this. One of the worst things that can happen to a programmer is to become a code monkey. Only implementing things that other people imagine. Losing creativity. Following orders. Don't let this happen to you! Here is a tip on how to nourish your creativity, at least a little every week. It's very simple: Allocate 4 hours pr. week where you can create anything you want. Focus on creating. Don't let anybody interrupt you. Move to a cafe. Lock your office. Don't consume. Don't read Hacker News. Don't consume Twitter. Use the 4 hours to create something! Want to get a bit inspired? Watch this video of John Cleese about creativity - it's great!
The ultimate vimrc on Github
I have released a new version of my Vim configuration!
Read the documentation and get it from here:
Announcements
·
Code
·
Code improvement
·
Code rewrite
·
Tips
·
VIM Editor
•
Permanent link
•
29. May
Awesome coding music
You need some awesome electronic music when you code. Here are some of my favorite:
If you want to recommend me some artists/tracks write an email to amix@amix.dk ;-) WSGI Production Setup: uWSGI, supervisor and nginx![]() In this post I present a uWSGI, supervisor and nginx setup, which is probably the currently best way to run WSGI applications (including Django). For Todoist and Wedoist we ran CherryPy's WSGI server for a long time. CherryPy has served us well, but after upgrading to a recent version we ran into deadlock issues. This forced us to look for alternatives, since we could not figure out what the problem was (and it's unsustainable to downgrade to a very old version). Why we picked uWSGI?
How to run it behind supervisorsupervisor lets you easily control and monitor other processes (and restart them if they crash). Our /etc/supervisor.d/uwsgi looks something like this:
[unix_http_server]
file=/var/run/supervisor_uwsgi.sock
[supervisord]
pidfile=/var/run/supervisord_uwsgi.pid
logfile_backups=1
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor_uwsgi.sock
[program:todoist1]
command = /usr/local/bin/uwsgi -s 127.0.0.1:14001
--file /home/ubuntu/todoist/uwsgi_todoist.py --callable app
--processes 2 -t 60 --disable-logging -M --need-app -b 32768
user=ubuntu
stopsignal=INT
The interesting part of the uWSGI configuration are following:
nginx setupOur nginx setup looks something like this. Do note that we are using nginx'es upstream to distribute the load (for CherryPy we used haproxy):
http {
upstream todoist_uwsgi {
server localhost:14001;
server localhost:14002;
...
}
...
server {
...
location / {
error_page 502 /error_502.html;
include uwsgi_params;
uwsgi_param X-Real-IP $remote_addr;
uwsgi_param Host $http_host;
uwsgi_pass todoist_uwsgi;
}
}
...
}
Special case for slow requestsIn Wedoist it's possible to upload large files. To bypass this you must handle uploading requests specially and set a much larger timeout. For Weodist we are running servers that only handle uploads:
[program:wedoist8]
command = /usr/bin/uwsgi -s 127.0.0.1:14008
--file /home/ec2-user/wedoist/uwsgi_wedoist.py --callable app
--processes 4 -t 6000 --disable-logging -M --need-app -b 32768
user=ec2-user
stopsignal=INT
As you can see -t is set to 6000 seconds, which means that the process/request will be considered dead after not responding for 6000 seconds. In nginx configuration we also set uwsgi_read_timeout and uwsgi_send_timeout to 6000 and we redirect upload requests to a special upstream servers:
location /Uploader/attachFile {
error_page 502 /error_502.html;
uwsgi_read_timeout 6000;
uwsgi_send_timeout 6000;
include uwsgi_params;
uwsgi_param X-Forwarded-Proto https;
uwsgi_param X-Real-IP $remote_addr;
uwsgi_param Host $http_host;
uwsgi_pass upload_cores;
}
That's about it. Hope somebody will find this useful :-) Happy hacking! Displaying timezones better in Python
I have released timezones for Python, it makes timezones more user-friendly for the users by formatting timezones better and auto-guessing timezone based on the user's IP address.
sunny leone lanny barbie avisunny leone ki pushisunny leone ki chudai photossunny leone kissing torrents fullsunny leone loves hd porn megavideosunny leone megavideo You can:
The library provides:
Example usage of the library: from timezones.tz_rendering import html_render_timezones
html_timezones = html_render_timezones(select_name=timezone',
current_selected=current_timezone,
user_ip=get_current_ip(),
first_entry=_('Select your timezone'))
A screenshot of the library in use [in Wedoist]:
Code
·
Code improvement
·
Code rewrite
·
Design
·
Python
·
Todoist
·
Wedoist
•
Permanent link
•
5. May
Updating caching headers for Amazon S3 and CloudFront
I made a major blunder when setting caching headers for Amazon S3 and CloudFront. Making such a blunder makes my sites slower and costs more in bandwidth. In this little blog post I will detail how to fix this and make sure you use correct caching headers.
Use the correct syntaxThe first rule, make sure that the syntax is correct. Correct syntax looks like this:
For me, I used following syntax (it's wrong and wont be understood by browsers!):
Read more in RFC 2616 for all the details sounding headers. Be greedy and use file versioningUse file versioning (for example make md5 hash a part of the name). You are forced to do this anyway since CloudFront does not support invalidations that well. sunny leone ki fudisunny leone mattsunny leone mediafiretorrentebook quando i giganti abitavano la terra in pdf sunny leone ki chudai hd wallpaperssunny leone kisses videosunny leone latest movies watch online Already using file versioning? Great, then set your expires a lot of years in the future, since the filename will change when the files changes (i.e. you don't have to worry about invalidating old files). Made a blunder? Use my script to update all S3 files in a bucketBefore you update headers to every S3 object make sure that the code works by testing it on dummy objects. I had a lot of issues getting it to work, since it will replace older metadata and not just update it. You can use my script (but it's not bulletproof, so be sure that any missing headers that you use are copied over to the updated metadata). You will need to do following:
#!/usr/bin/env python
"""
fix_s3_cache_headers
~~~~~~~~
Updates S3 objects with new cache-control headers.
Usage::
python fix_cloudfront.py <bucket_name> <keys>*
Examples::
Updates all keys of avatars.wedoist.com bucket::
python fix_cloudfront.py avatars.wedoist.com
Updates only one key::
python fix_cloudfront.py avatars.w.com d39c2.gif
Read more here::
http://amix.dk/blog/post/19687
:copyright: by Amir Salihefendic ( http://amix.dk/ )
:license: MIT
"""
import sys
import mimetypes
import email
import time
import types
from datetime import datetime, timedelta
from boto.s3.connection import S3Connection
from boto.cloudfront import CloudFrontConnection
#--- AWS credentials ----------------------------------------------
AWS_KEY = '...'
AWS_SECRET = '...'
#--- Main function ----------------------------------------------
def main(s3_bucket_name, keys=None):
s3_conn = S3Connection(AWS_KEY, sunny leone ki chudaiallstar comedy jam sunny leone loves hd porn avisunny leone ki nangi photosunny leone ki cootsunny leone mediafire torrentsrargang bang comix sunny leone mobile 3gp sex AWS_SECRET)
bucket = s3_conn.get_bucket(s3_bucket_name)
if not keys:
keys = bucket.list()
for key in keys:
if type(key) == types.StringType:
key_name = key
key = bucket.get_key(key)
if not key:
print 'Key not found %s' % key_name
continue
# Force a fetch to get metadata
# see this why: http://goo.gl/nLWt9
key = bucket.get_key(key.name)
aggressive_headers = _get_aggressive_cache_headers(key)
key.copy(s3_bucket_name, key, metadata=aggressive_headers, preserve_acl=True)
print 'Updated headers for %s' % key.name
#--- Helpers ----------------------------------------------
def _get_aggressive_cache_headers(key):
metadata = key.metadata
metadata['Content-Type'] = key.content_type
# HTTP/1.0 (5 years)
metadata['Expires'] = '%s GMT' %\
(email.Utils.formatdate(
time.mktime((datetime.now() +
timedelta(days=365*5)).timetuple())))
# HTTP/1.1 (5 years)
metadata['Cache-Control'] = 'max-age=%d, public' % (3600 * 24 * 360 * 5)
return metadata
if __name__ == '__main__':
main( sys.argv[1],
sys.argv[2:] )
Product features vs. UI elements on the screen
Like noted in The essence of minimal product design successful products hide complexity from the users. Balsamiq has a great graph illustrating this as well.
Hiring talented iOS and Android developers
We are expanding the team at Todoist and Wedoist with iOS and Android programmers.
Some of our stats:
Join us either freelance or full-time and work on something that makes the world more productive. Send your resume to amix@amix.dk, be sure to include some code you are proud of (or a link to your GitHub/BitBucket profile). Open sourced coffee-watcher, less-watcher and watcher_lib
I have updated/published following libraries today:
Basically these scripts are useful for development as you don't need to think about recompiling your files. You can also use watcher_lib to implement custom watchers. coffee-watchersudo npm install coffee-watcher
coffee-watcher -p [prefix] -d [directory]
Options:
-d Specify which directory to scan.
-p Which prefix should the compiled files have?
Default is style.coffee will be compiled to .coffee.style.css
-h Prints help
less-watchersudo npm install less-watcher
less-watcher -p [prefix] -d [directory]
Options:
-d Specify which directory to scan.
-p Which prefix should the compiled files have?
Default is style.less will be compiled to .less.style.css
-h Prints help
watcher_libsudo npm install watcher_lib How to build a generic watcher (here is less-watcher's implementation): # Use `watcher-lib`, a library that abstracts away most of the implementation details.
watcher_lib = require 'watcher_lib'
# Searches through a directory structure for *.less files using `find`.
# For each .less file it runs `compileIfNeeded` to compile the file if it's modified.
findLessFiles = (dir) ->
watcher_lib.findFiles('*.less', dir, compileIfNeeded)
# Keeps a track of modified times for .less files in a in-memory object,
# if a .less file is modified it recompiles it using compileLessScript.
sunny leone mobile 3gp mp4 videotorrentsunny leone massagesunny leone ki chudai imagessunny leone lesbiensunny leone lexi stonerear_window__1954__dub__avitxt sunny leone ki chut #
# When starting the script all files will be recompiled.
WATCHED_FILES sunny leone mediafire linkssunny leone ki gaandsunny leone mediafire wmv avio polnocy w paryzu pl sunny leone loves matt onlinesunny leone lesbian xxx moviesunny leone mediafire movie full freetorrent = {}
compileIfNeeded = (file) ->
watcher_lib.compileIfNeeded(WATCHED_FILES, file, compileLessScript)
# Compiles a file using `lessc`. Compilation errors are printed out to stdout.
compileLessScript = (file) ->
fnGetOutputFile = (file) -> file.replace(/([^\/\\]+)\.less/, "#{argv.p}$1.css")
watcher_lib.compileFile("lessc #{ file }", sunny leone ki chut hd wallpaperssunny leone lesbiansunny leone lesbian hardcoresunny leone loves mattug free tutorials sunny leone mobile clipsmp4lectra diamino fashion v5r2 mult rar sunny leone latest movies file, fnGetOutputFile)
# Starts a poller that polls each second in a directory that's
# either by default the current working directory
# or a directory that's passed through process arguments.
watcher_lib.startDirectoryPoll(argv.d, findLessFiles)
css_image_concat: Improve performance by concating your images
I have updated my CSS image contact script from 2007. This script can concat images into one image and create a CSS file with classes. This is a super useful optimization when you want decrease issuing a lot of HTTP requests due to a lot of small images (like icons).
What is the idea behind this?The idea is to take all separated images and concat them to one image file:
This means that only one HTTP request is made to fetch all the images. CSS is then used to display an image (by using background offsets): .cmp_email_icon {
background: transparent url(all_images.gif) 0 -48px no-repeat;
width: 21px;
height: 16px;
}
Installing itsudo pip install css_image_concat This script also requires ImageMagick. Using it$ css_image_concat static/icons static/all_icons.png static/all_icons.css Parsed 18 in static/icons Written CSS file: static/all_icons.css Written image file: static/all_icons.png ---- GitHub and PyPiYou can checkout the code from here: Focusing is about saying no - Steve Jobs (WWDC'97)
When Steve Jobs returned back to Apple in 1997 he fired thousands of people and discontinued lots of projects. In WWDC'97 he explained why:
|
|