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
UNDO A LAST LOCAL COMMIT | |
# use --soft if you want to keep your changes | |
git reset --soft HEAD^ | |
# use --hard if you don't care about keeping the changes you made | |
git reset --hard HEAD^ | |
--------------------------------- | |
UNDO A LAST PUBLIC COMMIT |
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
#!/bin/bash | |
################################################################################################## | |
## ## | |
## Credits: ## | |
## - http://www.phpit.com.br/artigos/configurando-ssl-servidor-de-desenvolvimento-apache.phpit ## | |
## - http://wime.com.br/2013/06/28/como-criar-certificado-ssl-no-apache-para-ubuntu-12-04/ ## | |
## ## | |
################################################################################################## |
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
PS.: Your image need to have support for bash | |
command: bash -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000" | |
command: > | |
bash -c "python manage.py migrate | |
&& python manage.py runserver 0.0.0.0:8000" | |
Credits: https://stackoverflow.com/questions/30063907/using-docker-compose-how-to-execute-multiple-commands/30064175 |
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 node:8.9.4-alpine | |
RUN apk --no-cache add python build-base | |
RUN mkdir -p /app | |
WORKDIR /app |
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 run --net=host <docker-image> |
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 multiprocessing | |
import time | |
from random import randint | |
PROCESSES = 5 | |
WORKER_CALLS = 7 | |
def worker(num): | |
"""worker function""" | |
print 'Starting worker', num |
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
l1 = [1,2,6,8] | |
l2 = [2,3,5,8] | |
l3 = [x for x in l1 if x not in l2] # l3 will contain [1, 6] |
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
# reference: | |
# https://stackoverflow.com/questions/6974695/python-process-pool-non-daemonic/8963618#8963618 | |
#!/usr/bin/env python | |
# -*- coding: UTF-8 -*- | |
import multiprocessing | |
# We must import this explicitly, it is not imported by the top-level | |
# multiprocessing module. | |
import multiprocessing.pool |
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
# artigo onde o autor explica o motivo de travamento | |
https://pythonspeed.com/articles/python-multiprocessing/ | |
# multiprocessing.set_start_method | |
https://docs.python.org/3/library/multiprocessing.html#multiprocessing.set_start_method | |
# AttributeError: Can't pickle local object | |
https://stackoverflow.com/questions/52265120/python-multiprocessing-pool-map-attributeerror-cant-pickle-local-object | |
# AttributeError: Can\'t pickle local object \'_objective_function_wrapper.<locals>.inner #2189 |