Skip to content

Instantly share code, notes, and snippets.

View 3mrdev's full-sized avatar
👨‍💻
Messing things up

Amr Abd-Alkrim 3mrdev

👨‍💻
Messing things up
View GitHub Profile
@3mrdev
3mrdev / wkhtmltopdf.sh
Created April 23, 2018 20:57 — forked from faniska/wkhtmltopdf.sh
Install wkhtmltopdf with patched QT on Ubuntu Linux
# Uncomment the next line if you have installed wkhtmltopdf
# sudo apt remove wkhtmltopdf
cd ~
# Select an appropriate link for your system (32 or 64 bit) from the page https://wkhtmltopdf.org/downloads.html and past to the next line
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
tar xvf wkhtmltox*.tar.xz
sudo mv wkhtmltox/bin/wkhtmlto* /usr/bin
sudo apt-get install -y openssl build-essential libssl-dev libxrender-dev git-core libx11-dev libxext-dev libfontconfig1-dev libfreetype6-dev fontconfig
@3mrdev
3mrdev / multiple-php-versions-on-ubuntu-16.04.md
Created December 5, 2018 14:47 — forked from aaronbloomfield/multiple-php-versions-on-ubuntu-16.04.md
Running multiple PHP versions on Apache2 and Ubuntu 16.04

Setting up multiple apache2 instances on Ubuntu 16.04

PHP handling on apache is done via modules of one sort or another, and running multiple version is problematic on a single instance. The solution is to run two instances of apache on the same machine. This allows one instance to run PHP 7 (the default on 16.04), and another can run PHP 5. Since normal http/https is on ports 80 and 443, the second instance will run on ports 81 and 444. Since it is running on the same machine, all file system and database access is the exact same.

All the commands herein have to be run as root, or with sudo prefixed to the command.

  1. Read /usr/share/doc/apache2/README.multiple-instances

  2. Run sh ./setup-instance php5 from /usr/share/doc/apache2/examples, where php5 is the suffix for the second site; all commands for the second site will have that suffix. This will keep all of the same configuration for all sites on the new instance, including SSL certif

@3mrdev
3mrdev / app.js
Last active April 21, 2023 08:57
Deploy Flutter Web App in a SharedHosting using NodeJs
var express = require('express');
var path = require('path');
var cookieParser = require('cookie-parser');
var logger = require('morgan');
var app = express();
app.use(logger('dev'));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
@3mrdev
3mrdev / package.json
Created April 22, 2020 19:28
Deploy Flutter Web App in a Shared Hosting with NodeJs package.json
{
"name": "flutter-web-app",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"cookie-parser": "~1.4.4",
"debug": "~2.6.9",
@3mrdev
3mrdev / odoo_autorestart.sh
Created May 19, 2020 08:26
Simple Bash Script To Restart Odoo Server After Out of Memory Crash
#!/bin/bash
SERVICE=/odoo/odoo-server/odoo-bin
if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
#echo "1"
echo "$SERVICE is running well at `date`" >> /home/firebits/restart.log
else
#echo "2"
echo "$SERVICE is not running. Restarting... at `date`" >> /home/firebits/restart.log
/etc/init.d/odoo-server start > /dev/null
@3mrdev
3mrdev / settings.py
Last active December 11, 2022 09:16
Odoo Configuration Example
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
your_field = fields.Many2one("module.model",string="Your Field", config_parameter='your_module.your_field')
def set_values(self):
super(ResConfigSettings, self).set_values()
ICPSudo = self.env['ir.config_parameter'].sudo()
ICPSudo.set_param('your_module.your_field', self.your_field.id)
@3mrdev
3mrdev / report.xml
Last active February 23, 2021 13:46
Odoo Custom Report With Wizards
<odoo>
<report id="example_report"
model="example.report.wizard"
string="Example (PDF)"
report_type="qweb-pdf"
name="your_module.example_report_view"
menu="False"/>
<template id="example_report_view">
<t t-call="web.html_container">
@3mrdev
3mrdev / cd.yaml
Last active June 7, 2021 12:43
Github Actions SSH Deploy Workflow
name: Remote ssh command
on:
push:
branches: [ main ]
jobs:
build:
name: Build
@3mrdev
3mrdev / wizard.py
Created June 8, 2021 23:41
Odoo Wizards
from odoo import models, fields, api
class PopupWizard(models.TransientModel):
_name = 'popup.wizard'
title = fields.Char()
start_date = fields.Datetime()
def confirm(self):
pass
@3mrdev
3mrdev / domain.py
Last active August 3, 2021 09:00
On Change Domain by a method (Odoo)
@api.onchange('partner_type')
def onchange_partner_type(self):
domain = []
return {'domain': {'partner_id': domain}}