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
public fetchABunchOfData (rootObj: RootObj): Observable<Project> { | |
// Returned original RootObj as an Observer when nested resource is fetched | |
let returnedData = new ReplaySubject(1); | |
let firstObservable = Observable.forkJoin( | |
this._cloud.getSomeRestData(rootObj.id), | |
this._cloud.getOtherRestData(rootObj.id) | |
); | |
// Execute first two Rest calls (someData and OtherData) |
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
if [ -d "${HOME}/cache/python3_env" ]; then echo "venv exists"; else virtualenv -p $(which python3) "${HOME}/cache/python3_env";fi | |
source "${HOME}/cache/python3_env/bin/activate" | |
pip install -r server/requirements/development.txt | |
nvm install 5 | |
npm install -g gulp bower | |
cd webapp | |
bower install | |
npm install | |
cd .. |
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
# ViewSets define the view behavior. | |
class FooViewSet(viewsets.ModelViewSet): | |
lookup_field = 'slug' | |
queryset = Foo.objects.all() | |
serializer_class = FooSerializer | |
def get_queryset(self): | |
""" | |
This view should return a list of all records | |
""" |
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
AWSIID=$(aws ec2 run-instances --image-id ami-8da458e6 --count 1 --instance-type t2.micro \ | |
--key-name myKeys --security-group-ids sg-XXXXXXXX \ | |
| json -aH Instances | json -aH InstanceId); time aws ec2 wait instance-running | |
aws ecs register-task-definition --cli-input-json file://elasticsearch.json --region us-east-1 | |
aws ecs register-task-definition --cli-input-json file://redis.json --region us-east-1 | |
aws ecs list-task-definitions --region us-east-1 | |
aws ecs run-task --task-definition foobar-elasticsearch:1 --count 1 --region us-east-1 |
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 os | |
import sys | |
import time | |
import boto3 | |
import botocore | |
import pprint | |
from invoke import run, task | |
DB_CONFIG = { | |
# SecurityGroup='sg-name" with ingress on port 5432 and source from itself |
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
# Download latest image from http://blog.hypriot.com/downloads/. Assuming v0.8.0. | |
unzip hypriotos-rpi-v0.8.0.img.zip | |
# And identify SSD disk | |
diskutil list | |
# Unmount disk. Assuming we identified /dev/disk2 in previous step | |
diskutil unmountdisk /dev/disk2 | |
# Flash SD card. May take up to 5min with no feedback |
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
//Sample using LiquidCrystal library | |
#include <LiquidCrystal.h> | |
#include <CurieBLE.h> | |
// select the pins used on the LCD panel | |
LiquidCrystal lcd(8, 9, 4, 5, 6, 7); | |
// define some values used by the panel and buttons | |
int lcd_key = 0; | |
int adc_key_in = 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
{% extends "base.html" %} | |
{% load i18n %} | |
{% block media %} | |
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/s/bs/dt-1.10.10,r-2.0.0/datatables.min.css"/> | |
{% endblock %} | |
{% block js %} | |
<!-- DataTable --> | |
<script type="text/javascript" src="https://cdn.datatables.net/s/bs/dt-1.10.10,r-2.0.0/datatables.min.js"></script> |
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
if [ -f ~/.bashrc ]; then | |
source ~/.bashrc | |
fi | |
# pip should only run if there is a virtualenv currently activated | |
export PIP_REQUIRE_VIRTUALENV=true | |
gpip(){ | |
# gpip allows to install on global env | |
PIP_REQUIRE_VIRTUALENV="" pip "$@" | |
} |