Skip to content

Instantly share code, notes, and snippets.

View rnovec's full-sized avatar
🏡
Working remotely

Raúl Novelo rnovec

🏡
Working remotely
View GitHub Profile
@rnovec
rnovec / tweet-selenium.py
Created August 15, 2018 18:38 — forked from dannguyen/tweet-selenium.py
how to send a tweet through Firefox using Python + Selenium
"""
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`...)
@rnovec
rnovec / api-pagination.js
Last active November 10, 2019 04:57
simple and useful example of API pagination implementation
// 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
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
@rnovec
rnovec / docker-compose.yml
Created January 26, 2020 02:53
Dockerizing Django
version: '3'
services:
###
# services
###
django:
build: .
network_mode: host
command: python manage.py runserver 0.0.0.0:3001
volumes:
@rnovec
rnovec / Dockerfile
Last active March 17, 2020 14:49
Dockerinzing Python/Django
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
@rnovec
rnovec / scrapyd-heroku.py
Created February 10, 2020 02:52
Script to run Scrapyd in Heroku
#!/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
@rnovec
rnovec / Dockerfile
Last active July 18, 2022 04:23
Dockerfile for python app & ghostscript
# 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
@rnovec
rnovec / docker-compose.yml
Created March 17, 2020 14:43
Docker compose for Scrapy App
# Docker Compose Services
#
# For more information about this section see:
# https://docs.docker.com/compose/
version: '3'
services:
###
# services
###
@rnovec
rnovec / docker-compose.yml
Created March 17, 2020 14:51
Docker compose for Django, Celery worker, RabbitMQ & SocketIO
version: '3'
services:
###
# services
###
# main app
web:
build: .
network_mode: host
@rnovec
rnovec / SmallestPositive.md
Last active May 26, 2022 19:43
Smallest positive integer

Algorithms

Problem #1

/*
 * 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.