du -sh {directory}
list display size of directory in human readable format.du -sh *
show size of each directory in the current pathdf
disk space usage
$ du -sh *
11M Applications
1.9G Desktop
14G Documents
8.0K Downloads
I am the owner of lvh.me. And I'm glad to hear it's helpful. In truth, it's just a fancy DNS trick. lhv.me and all of it's sub-domains just point back to your computer (127.0.0.1). That means running ssl is as simple (or difficult) as running ssl on your computer. | |
I'm not sure how comfortable you are with the command line, but here's my how I setup my development environment. (rvm, passenger, nginx w/ SSL, etc). | |
# Install rvm (no sudo!) | |
# ------------------------------------------------------ | |
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head ) | |
source ~/.rvm/scripts/rvm | |
rvm install ree-1.8.7-2010.02 |
function get_avatar_from_service(service, userid, size) { | |
// this return the url that redirects to the according user image/avatar/profile picture | |
// implemented services: google profiles, facebook, gravatar, twitter, tumblr, default fallback | |
// for google use get_avatar_from_service('google', profile-name or user-id , size-in-px ) | |
// for facebook use get_avatar_from_service('facebook', vanity url or user-id , size-in-px or size-as-word ) | |
// for gravatar use get_avatar_from_service('gravatar', md5 hash email@adress, size-in-px ) | |
// for twitter use get_avatar_from_service('twitter', username, size-in-px or size-as-word ) | |
// for tumblr use get_avatar_from_service('tumblr', blog-url, size-in-px ) | |
// everything else will go to the fallback | |
// google and gravatar scale the avatar to any site, others will guided to the next best version |
PEP: 423 | |
Title: Naming conventions and recipes related to packaging | |
Version: $Revision$ | |
Last-Modified: $Date$ | |
Author: Benoît Bryon <benoit@marmelune.net> | |
Discussions-To: <distutils-sig@python.org> | |
Status: Deferred | |
Type: Informational | |
Content-Type: text/x-rst | |
Created: 24-May-2012 |
#!/usr/bin/env python | |
from hashlib import md5 | |
trans_5C = "".join(chr(x ^ 0x5c) for x in xrange(256)) | |
trans_36 = "".join(chr(x ^ 0x36) for x in xrange(256)) | |
blocksize = md5().block_size | |
def hmac_md5(key, msg): | |
if len(key) > blocksize: | |
key = md5(key).digest() | |
key += chr(0) * (blocksize - len(key)) |
var parser = document.createElement('a'); | |
parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
parser.protocol; // => "http:" | |
parser.hostname; // => "example.com" | |
parser.port; // => "3000" | |
parser.pathname; // => "/pathname/" | |
parser.search; // => "?search=test" | |
parser.hash; // => "#hash" | |
parser.host; // => "example.com:3000" |
du -sh {directory}
list display size of directory in human readable format.du -sh *
show size of each directory in the current pathdf
disk space usage$ du -sh *
11M Applications
1.9G Desktop
14G Documents
8.0K Downloads
{% load crispy_forms_tags %} | |
{% block content %} | |
{% crispy form %} | |
{% endblock %} |
To change a field name in django 1.7+ | |
1. Edit the field name in the model (but remember the old field name: you need it for step 3!) | |
2. Create an empty migration | |
$ python manage.py makemigrations --empty myApp | |
3. Edit the empty migration (it's in the migrations folder in your app folder, and will be the most recent migration) by adding | |
migrations.RenameField('MyModel', 'old_field_name', 'new_field_name'), | |
to the operations list. |
#!/bin/bash | |
# | |
find . -type f -name '*.py[co]' -delete | |
find . -type d -name '__pycache__' -delete |
Locate the path to the interpreter for the language you are writing in with the which
command.
which node
which python
which bash
which ruby
Add that path as an interpreter directive (using #!
) on the first line of your script. For example if you want to write a node script and which node
returned /usr/local/bin/node
, the first line of your script should be: