This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
API_URL = 'https://api.alwaysdata.com/v1/' | |
API_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx' | |
ACCOUNT_NAME = 'account_name' | |
# Updating a mailbox | |
mailbox_id = 12345 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mongoengine import Document, StringField, ReferenceField, BooleanField | |
class A(Document): | |
a = StringField() | |
class B(Document): | |
b = StringField() | |
boolfield = BooleanField(default=False) | |
ref = ReferenceField(A) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# myapp/partner/strategy.py | |
from decimal import Decimal as D | |
from oscar.apps.partner import strategy, prices | |
DEFAULT_RATE = D('0.196') | |
PRODUCT_CLASSES_RATES = { | |
'cours': 0, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd ~ | |
mkdir -p .local | |
mkdir -p tmp | |
cd tmp | |
git clone https://github.com/joyent/node.git . | |
git checkout v0.10.31 | |
./configure --prefix=~/.local | |
make LINK=g++ install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rest_framework import permissions | |
class IsReadOnly(permissions.BasePermission): | |
""" | |
Object-level permission to only allow read-only operations. | |
""" | |
def has_permission(self, request, view): | |
# Read permissions are allowed to any request, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import json | |
import requests | |
address = 'http://api.alwaysdata.com/v1/domain/record/' | |
credentials = ('APIKEY account=batman', '') | |
response = requests.post( | |
address, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create our environment directory | |
$ mkdir .local | |
Create a temporary directory | |
$ mkdir tmp | |
Install Python 2.7 | |
$ cd tmp | |
$ wget https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz | |
$ tar zxvf Python-2.7.9.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import json | |
import requests | |
address = 'https://api.alwaysdata.com/v1/domain/record/' | |
credentials = ('APIKEY account=foobar', '') | |
data = { | |
'name': '', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import argparse | |
import fileinput | |
import grp | |
import json | |
import urllib.request | |
import os | |
import subprocess | |
import tarfile |