Skip to content

Instantly share code, notes, and snippets.

View lee-pai-long's full-sized avatar
💭
Work In Progress

Saïdina MOHAMED ALI lee-pai-long

💭
Work In Progress
  • Marseille (France)
View GitHub Profile

Linux Mint 17.2] Install htpasswd command

$ [sudo] apt-get update \
>  && [sudo] apt-get install apache2-utils
@lee-pai-long
lee-pai-long / nginx.conf
Last active March 30, 2018 12:30 — forked from weapp/nginx.conf
Return common errors as json in Nginx
# TODO: Change file name to errors.conf and load it on APIs servers block.
# TODO: Change .html to .json.
error_page 500 /500.html;
location /500.html{
return 500 '{"error": {"status_code": 500,"status": "Internal Server Error"}}';
}
error_page 502 /502.html;
location /502.html{
return 502 '{"error": {"status_code": 502,"status": "Bad Gateway"}}';
@lee-pai-long
lee-pai-long / virtialenv_prompt.sh
Last active September 5, 2017 13:31
Force virtualenv prompt change with pyenv-virtualenv
# Force prompt update with pyenv-virtualenv
# see: https://github.com/pyenv/pyenv-virtualenv/issues/135
function virtualenv_prompt {
WANTED_PROMPT="(${VIRTUAL_ENV##*/}) $ORIGINAL_PROMPT"
# Current virtualenv
if [[ $VIRTUAL_ENV != "" ]] && [[ $PS1 != $WANTED_PROMPT ]]; then
PROMPT=$WANTED_PROMPT
else
@lee-pai-long
lee-pai-long / caller_info.py
Last active March 20, 2024 16:42 — forked from techtonik/caller_name.py
Python - inspect - Get full caller info: package, module, (class), function, line.
"""
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <[email protected]>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
@lee-pai-long
lee-pai-long / default.makefile
Created June 23, 2017 12:52
Default makefile with just a help target
# Include all local tasks.
include tasks/*.mk
# Add color to help printing.
PRINT = '{printf "\033[36m%-16s\033[0m : %s\n", $$1, $$2}'
help: ## Show this message.
@echo "usage: make [task]\n" \
&& echo "available tasks:" \
@lee-pai-long
lee-pai-long / use-plantuml_atom.md
Last active June 11, 2018 07:52
Use PlantUML within Atom

[Atom] Install PlantUML

Install Graphviz

$ [sudo] apt-get update -qq \
> && [sudo] apt-get install graphviz
@lee-pai-long
lee-pai-long / flask_template_decorator.py
Last active June 10, 2019 06:23
Flask template decorator.
"""Flask template decorator example.
:examples:
.. code-block:: python
# without the decorator
@app.route('/')
def index():
return render_template('index.html',
@lee-pai-long
lee-pai-long / install-gvm-and-use-go1.8_linux_mint.md
Last active September 5, 2017 13:32
Install Go(lang) Version Manager and use Go 1.8 on current workspace.

[GOLANG] Install gvm and use go1.8 on Linux Mint 17.2

$ [sudo] apt-get install \
>                   curl \
>                   git \
>                   mercurial \
>                   make \
@lee-pai-long
lee-pai-long / remove-images-or-containers_docker.md
Last active September 5, 2017 13:32
Docker remove container or image

[DOCKER] Remove

Remove all stopped containers.

$ [sudo] docker rm $([sudo] docker ps -a -q)
@lee-pai-long
lee-pai-long / werkzeug-gevent_flask.md
Last active September 5, 2017 13:32
WIP: Running werkzeug with gevent

[FLASK] Running werkzeug with gevent

WARNING: WIP since first test doesn't seems to work

With a create_app() function Factory, in run.py instead of something like this:

from project.app import create_app