This file contains hidden or 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
image: node:latest | |
cache: | |
paths: | |
- node_modules/ | |
before_script: | |
# Install ssh-agent if not already installed, it is required by Docker. | |
# (change apt-get to yum if you use a CentOS-based image) | |
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )' |
This file contains hidden or 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
class Foo(Model): | |
class Meta: | |
# Here, we specify the database and collection names. | |
# A connection to your DB is automatically created. | |
database = "minimongo" | |
collection = "rocks" | |
foo = Foo.collection.find_one() | |
fname = foo.first_name |
This file contains hidden or 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
# Step 1, install gunicorn | |
pip install gunicorn | |
# Step 2, run it. | |
gunicorn app:app |
This file contains hidden or 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
# | |
# This is the core of my handler function | |
# | |
batch_size = 100 # This needs to change based on the size of your objects | |
parser = ijson.parse(f) | |
counter = 0 | |
to_process = [] | |
for prefix, event, value in parser: | |
if (prefix, event) == ("item", "start_map"): | |
music_item = dict(albums=[]) |
This file contains hidden or 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
sudo dd if=/dev/zero of=/swapfile1 bs=1024 count=524288 | |
sudo chown root:root /swapfile1 | |
sudo chmod 0600 /swapfile1 | |
sudo mkswap /swapfile1 | |
sudo swapon /swapfile1 | |
free -m |
This file contains hidden or 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
1 - 2015-09-02 07:56:21.794712 | |
2 - 2015-09-02 07:56:21.805649 | |
3 - 2015-09-02 07:56:22.984915 | |
4 - 2015-09-02 07:56:22.984987 | |
5 - 2015-09-02 07:56:26.205471 |
This file contains hidden or 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
Shows = mongoengine.Document() | |
Movies = mongoengine.Document() | |
Recommendations = mongoengine.Document() | |
def front_page(self): | |
print("1 - %s" % datetime.now()) | |
tv_shows = Show.objects.get(genre="comedy") | |
print("2 - %s" % datetime.now()) | |
movies = Movie.objets.get(genre="comedy") | |
print("3 - %s" % datetime.now()) |
This file contains hidden or 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
1 - 2015-09-02 07:48:03.367938 | |
2 - 2015-09-02 07:48:03.448904 | |
3 - 2015-09-02 07:48:03.490221 | |
4 - 2015-09-02 07:48:03.490249 | |
5 - 2015-09-02 07:48:10.852490 |
This file contains hidden or 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
Shows = mongoengine.Document() | |
Movies = mongoengine.Document() | |
Recommendations = mongoengine.Document() | |
def front_page(self): | |
tv_shows = Show.objects.get(genre="comedy") | |
movies = Movie.objets.get(genre="comedy") | |
recommendations = Recommendations.objects.get(user_id=current_user) | |
return render_template("template/front_page.html", |
This file contains hidden or 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
login_user(user, remember=False) |