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
| virtualenv --no-site-packages --python=/usr/bin/python2.7 env |
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.interval = setInterval(() => { | |
| this.fucntion()...; | |
| }, 1000); | |
| ngOnDestroy() { | |
| if (this.interval) { clearInterval(this.interval); } | |
| } |
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. Create new container | |
| a) docker run -i -t ubuntu /bin/bash | |
| b) docker run --name rails_dev_container -i -t ubuntu ubuntu /bin/bash | |
| The command line flags - i -t provide an interactive shell in the new container | |
| 2. Show running docker containers ==> docker ps | |
| 3. Show list of current containers ==> | |
| a) docker ps -a (Show all containers, both stopped and running) | |
| b) docker ps -n x (shows the last x containers, running or stopped, ex: docker ps -n 5) |
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
| #!/bin/bash | |
| docker ps --all | grep -v 'CONTAINER' | awk '{ print $1 }' | xargs docker rm |
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
| # Now you can use it just like any other QuerySet method: | |
| # Document.objects.pdfs().smaller_than(1000).exclude(name='Article').order_by('name') | |
| # If you are only defining custom QuerySets in the Manager, | |
| # you can simply extend the models.QuerySet and in the model set the manager as objects = DocumentQuerySet.as_manager() | |
| class DocumentQuerySet(models.QuerySet): | |
| def pdfs(self): | |
| return self.filter(file_type='pdf') | |
| def smaller_than(self, size): |
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
| import {Injectable, EventEmitter} from 'angular2/core'; | |
| @Injectable() | |
| export class EmitterService { | |
| private static _emitters: { [ID: string]: EventEmitter<any> } = {}; | |
| static get(ID: string): EventEmitter<any> { | |
| if (!this._emitters[ID]) | |
| this._emitters[ID] = new EventEmitter(); |
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
| #! /bin/bash | |
| MYSQL="/opt/local/etc/LaunchDaemons/org.macports.mysql5/mysql5.wrapper" | |
| NGINX="/opt/local/sbin/nginx" | |
| PHPFPM="/opt/local/sbin/php-fpm" | |
| PIDPATH="/opt/local/var/run" | |
| MEMCACHED="/opt/local/bin/memcached -m 24 -P /opt/local/var/run/memcached.pid -u root" | |
| if [ $1 = "start" ]; then | |
| sudo $MYSQL start | |
| echo "Starting php-fpm ..." |
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
| cacheBust: { | |
| taskName: { | |
| options: { | |
| algorithm: 'sha1', | |
| deleteOriginals: true, | |
| length: 32, | |
| baseDir : "frontend/", | |
| assets: [ | |
| //'home/home.css', | |
| //'app-less.css', |
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 FileDownloadView(APIView): | |
| permission_classes = (IsAuthenticated,) | |
| def get(self, request, pk): | |
| # trade = Trade.objects.filter(account__portfolio=pk).values() | |
| trade = Trade.objects.filter(account__portfolio=pk) | |
| for t in trade: | |
| with open('names.csv', 'w') as csvfile: | |
| fieldnames = ['fake', 'confidence', 'counter_quantity', |