/*
* Write a function:
* function solution(A);
*
* that, given an array A of N integers, returns the smallest positive integer (greater than 0) that does not occur in 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
""" | |
Tweeting by controlling Firefox via Python + selenium | |
http://selenium-python.readthedocs.org/ | |
This script: | |
- Opens up Firefox | |
- Goes to https://www.twitter.com | |
- Clicks the login button | |
- logs you in (assuming you have your twitter password in a file named `mypassword.txt`...) |
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
// assume that you develop a course's API GET endpoint | |
// best practices is pagination of /v1/courses endpoint | |
// if you is receving page & limit paramas as a queries, aditional filter params are optional | |
// this is a example of our endpoint with pagination, sorting & filtering | |
// we have a request containing data like params, queries, headers... | |
const { reviews, status, title, page = 1, limit = 20, sort } = request.query // using object destructuring | |
let List = [] // get data form database |
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 serial | |
import time | |
# standard Python 3 | |
# create a serial port connection passing port & timeout | |
ser = serial.Serial('/dev/ttyACM0', 9600) | |
# bucle to read serial port all the time | |
while True: | |
if (ser.in_waiting > 0): # if serial port is active |
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
version: '3' | |
services: | |
### | |
# services | |
### | |
django: | |
build: . | |
network_mode: host | |
command: python manage.py runserver 0.0.0.0:3001 | |
volumes: |
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 python:3.6.6 | |
ENV PYTHONDONTWRITEBYTECODE 1 | |
ENV PYTHONUNBUFFERED 1 | |
WORKDIR / | |
COPY requirements.txt ./ | |
RUN pip install --upgrade pip | |
RUN pip install --no-cache-dir -r requirements.txt | |
RUN rm requirements.txt |
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 | |
from os.path import join, dirname | |
from sys import argv | |
from twisted.scripts.twistd import run | |
import scrapyd_heroku as project | |
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
# Dockerfile for Python App | |
# | |
# For more information about this section see: | |
# https://hub.docker.com/_/python | |
FROM python:3.6.6 | |
RUN apt-get update && apt-get -y install ghostscript && apt-get clean | |
WORKDIR /app | |
COPY . . | |
RUN pip install --upgrade pip |
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
# Docker Compose Services | |
# | |
# For more information about this section see: | |
# https://docs.docker.com/compose/ | |
version: '3' | |
services: | |
### | |
# services | |
### |
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
version: '3' | |
services: | |
### | |
# services | |
### | |
# main app | |
web: | |
build: . | |
network_mode: host |
OlderNewer