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
@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 / 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 / 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 / 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 / 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 / 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"}}';

Linux Mint 17.2] Install htpasswd command

$ [sudo] apt-get update \
>  && [sudo] apt-get install apache2-utils

[LINUX MINT] Install latest tmux

$ [sudo] apt-get update \
>   && [sudo] apt-get install \
>       -y python-software-properties software-properties-common \
>   && [sudo] add-apt-repository -y ppa:pi-rho/dev \
>   && [sudo] apt-get update \
>   && [sudo] apt-get install -y tmux-next

[Linux Mint 17.2] Install latest owncloud Client

Install

$ URL="http://download.opensuse.org/repositories/isv:/ownCloud:/desktop/Ubuntu_14.04/" \
> && wget -nv $URL/Release.key -O /tmp/Release.key \

[Atom] Use PlantUML

Install Graphviz

$ [sudo] apt-get update -qq \
> && [sudo] apt-get install graphviz