Skip to content

Instantly share code, notes, and snippets.

View SalahAdDin's full-sized avatar
🎯
Focusing

José Luis SalahAdDin

🎯
Focusing
View GitHub Profile
@SalahAdDin
SalahAdDin / commands.md
Last active November 1, 2018 13:15
Odoo tricks

Installing extra addons:

In shell

  • copy the directory of the module in ./addons
  • give permissions chmod -R 755 addons/<module_directory>
  • restart the container

In Odoo:

  • Activate the developer mode
@SalahAdDin
SalahAdDin / views.py
Last active March 10, 2018 18:16
Recipe views
# Golbal queries
class GlobalQueryMixin(object):
"""
Mixin for get a global template query
post: Most ranked recipe
tops: Five most ranked recipes
top fruits: Three most ranked fruit recipes
random: Four random recipes
fruits: Four fruit recipes
desserts: Four desserts recipes
@SalahAdDin
SalahAdDin / Commands.md
Last active February 8, 2018 15:34
Useful commands

Crontab

export EDITOR=nano
crontab -e
crontab -l

Docker

  • docker-compose up
  • docker-compose down
@SalahAdDin
SalahAdDin / Commands.md
Last active January 16, 2018 16:09
Supply EC2 instances for works with Docker

NOTE: For install all docker: curl -sSL https://get.docker.com | sh.

  1. Update the system and prepare requirements:
    $ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
    $ sudo apt-get update && sudo apt-get upgrade && sudo apt-get install apt-transport-https ca-certificates git  
    $ sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
  1. Open next file and clean it:
    $ sudo nano /etc/apt/sources.list.d/docker.list
  2. Add proper source list, in this case Ubuntu 16.04 server, save and close:
@SalahAdDin
SalahAdDin / formsets.py
Created October 8, 2017 13:23
Multiple formularios en vista
# PriorityFormSet = formset_factory(PriorityForm, extra=5, can_delete=True)
PriorityFormSet = modelformset_factory(Priority, form=PriorityForm, extra=3, can_delete=True)
# TicketStatusFormSet = formset_factory(TicketStatusForm, extra=3, can_delete=True)
TicketStatusFormSet = modelformset_factory(TicketStatus, form=TicketStatusForm, extra=3, can_delete=True)
# TicketTypeFormSet = formset_factory(TicketTypeForm, extra=3, can_delete=True)
TicketTypeFormSet = modelformset_factory(TicketType, form=TicketTypeForm, extra=3, can_delete=True)
class PriorityForm(forms.ModelForm):
http://www.twcenter.net/forums/showthread.php?682245-MOD-RELEASED-Rebell-s-Emergent-factions-reworked-!
http://www.twcenter.net/forums/showthread.php?680789-More-Meaningful-Seasons
http://www.twcenter.net/forums/showthread.php?680806-Dictator-s-Mods-(7-mods
http://www.twcenter.net/forums/showthread.php?680665-Occupation-and-Diplomatic-Options-(Confederations-etc-
http://www.twcenter.net/forums/showthread.php?710364-The-plans-for-1-7-(-Its-going-again-)/page4
http://www.twcenter.net/forums/showthread.php?721931-Marca-Hispanica-AoC-1-2-(Updated-23-03-2016)&highlight=Cordoba
http://www.twcenter.net/forums/showthread.php?683993-Rome-2-total-war-Surena-Epic-2-(Released-22-Apirl-2016-The-Global-Version)
@SalahAdDin
SalahAdDin / album.py
Last active May 11, 2017 07:27
Album problem's implementation.
import os
import math
import random
def get_new_album(n):
i = 1
# album = [[0 for x in range(n)] for x in range(n)]
album = [0 for x in range(n)]
# print(album)
@SalahAdDin
SalahAdDin / geo_tags.py
Created April 4, 2017 08:09
Trying to make a custom template tag.
import logging
import re
import requests
from django.conf import settings
from django.template import Library
from django.template import Node
from django.template import TemplateSyntaxError
from django.utils.html import format_html_join
@SalahAdDin
SalahAdDin / dev-server.js
Last active March 20, 2017 11:32
Configuration
// Creates a hot reloading development environment
const path = require('path');
const express = require('express');
const webpack = require('webpack');
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackHotMiddleware = require('webpack-hot-middleware');
const DashboardPlugin = require('webpack-dashboard/plugin');
const config = require('./config/webpack.config.development');
@SalahAdDin
SalahAdDin / command.sh
Last active August 15, 2016 08:20
Custom install commands
sudo add-apt-repository ppa:graphics-drivers/ppa &&
sudo add-apt-repository ppa:webupd8team/java &&
sudo add-apt-repository ppa:peterlevi/ppa &&
sudo apt-add-repository -y ppa:teejee2008/ppa &&
sudo add-apt-repository ppa:libreoffice/ppa &&
sudo add-apt-repository ppa:numix/ppa &&
sudo add-apt-repository ppa:docky-core/stable &&
sudo add-apt-repository ppa:inkscape.dev/stable &&
sudo add-apt-repository ppa:noobslab/icons &&
sudo add-apt-repository ppa:noobslab/themes &&