- Get all of these files into the target folder
- Run the following commands:
chmod +x *.sh
./nginx-start.sh
# Freshen homebrew | |
brew update | |
brew upgrade | |
# The main stuff we need | |
brew install postgresql | |
brew install postgis | |
brew install gdal | |
# Switch to postgis version 1.5.3 - 2.0 not supported yet |
# For anyone random finding this, yeah, I don't like Django performing the extra query to determine insert vs. update | |
class BaseModel(models.Model): | |
id = models.CharField(primary_key=True, max_length=512) | |
created = models.DateTimeField(auto_now_add=True) | |
updated = models.DateTimeField(auto_now=True) | |
version = models.IntegerField(default=1) | |
class Meta: | |
abstract = True |
# I always forget this command snippet and especially that ssh refuses if file privs aren't just so | |
cat ~/.ssh/id_rsa.pub | ssh user@remote-host "mkdir -p .ssh; chmod 700 .ssh; cat >> .ssh/authorized_keys2; chmod 600 .ssh/authorized_keys2" |
def get_less_static_dirs(): | |
"""get static-directory paths for apps that have less files | |
Assumptions: | |
* You want any LESS files from apps in INSTALLED_APPS | |
* You don't have LESS files in any extra folders in STATIC_DIRS (maybe I should fix that... always thought static_dirs was dumb) | |
""" | |
app_modules = [import_module(app) for app in INSTALLED_APPS] | |
maybe_less_static_dirs = [ | |
# For Django apps, __file__ should always be the path to __init__.pyc |
chmod +x *.sh
./nginx-start.sh
flake8 | |
docformatter | |
pylint | |
cricket | |
bugjar | |
duvet |
$ pip freeze -l | |
python-dateutil==1.5 | |
pytz==2013.8 | |
$ python | |
... | |
>>> from dateutil.parser import parse | |
>>> import datetime | |
>>> import pytz | |
>>> d = datetime.datetime.now(pytz.UTC) | |
>>> d |
def nested_from_native(nested_field, data): | |
if isinstance(nested_field, serializers.BaseSerializer): | |
return nested_field.from_native(data, None) | |
return nested_field.from_native(data) | |
class ListField(fields.WritableField): | |
def __init__(self, item_field, *args, **kwargs): | |
super(ListField, self).__init__(*args, **kwargs) |
from functools import wraps | |
def memoized_property(fget): | |
""" | |
Return a property attribute for new-style classes that only calls | |
it's getter on the first property access. The result is stored | |
and on subsequent accesses is returned, preventing the need to call | |
the getter any more. | |
http://docs.python.org/2/library/functions.html#property |
intToBinStr :: Int -> String | |
intToBinStr n = | |
let _shiftBits 0 s = s ++ "0" | |
_shiftBits 1 s = s ++ "1" | |
_shiftBits x s = _shiftBits (div x 2) (s ++ show (mod x 2)) | |
in _shiftBits n "" | |
main :: IO () | |
main = print $ intToBinStr 19 |