Skip to content

Instantly share code, notes, and snippets.

View ascorbic-acid's full-sized avatar

Imad Abdou ascorbic-acid

View GitHub Profile
@ascorbic-acid
ascorbic-acid / install-guide.md
Last active April 15, 2024 09:07
Install ERPNext v14 or v15 on Ubuntu 22.04 Production or Develop

Install ERPNext v14 or v15 on Ubuntu 22.04 Production or Develop

feel free to edit the parameters to suite your needs
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install software-properties-common \
nginx wget zip unzip git curl certbot python3-pip \
python3-dev python3-venv redis-server mariadb-server \
@ascorbic-acid
ascorbic-acid / script.txt
Last active December 10, 2022 07:17
Create Fake Dev Printer in Linux
# first install required package
sudo apt-get install ippserver
# create working directory for example PDF
mkdir PDF
# example for working virtual printer
ippserver -2 -M "HP" -P -d /home/pop/PDF -k -c /home/pop/PDF -m "XM80" -n 127.0.0.1 -l "ipp://127.0.0.1:8085" -p 8085 -vvv "Dev Printer1"
@ascorbic-acid
ascorbic-acid / script.txt
Created October 26, 2022 15:39
Create Linux Fake Camera from a Photo
--first install:
sudo apt install v4l2loopback-dkms
sudo apt install ffmpeg
--then run:
ffmpeg -loop 1 -re -i /path/to/picture.png -f v4l2 -vcodec rawvideo -pix_fmt yuv420p /dev/video0
@ascorbic-acid
ascorbic-acid / script.js
Last active April 3, 2022 05:55
jQuery Log all events
var temp = $.event.dispatch;
$.event.dispatch = function(event, arg2, arg3){
// the event that is passed is the native event, if you want the jquery
// event, you need the fixed event.
console.log(jQuery.event.fix( event ), arg2, arg3);
temp.call(this, event, arg2, arg3);
}
@ascorbic-acid
ascorbic-acid / lexup.py
Created November 12, 2021 07:58
LXD Backup Script Python3
#!/usr/bin/python3
import datetime
import os
import subprocess
import tempfile
import shutil
from dateutil.parser import parse
# Container names which you want to backup
@ascorbic-acid
ascorbic-acid / vscode-xdebug.txt
Created September 3, 2021 04:25
VSCode XDebug with php 7.4 fpm
first install xdebug:
sudo apt-get install php7.4-xdebug
edit config file with the following, also check the zend version (20190902) if it is different on your machine:
sudo nano /etc/php/7.4/mods-available/xdebug.ini
zend_extension="/usr/lib/php/20190902/xdebug.so"
xdebug.mode = debug
xdebug.start_with_request = yes
@ascorbic-acid
ascorbic-acid / gist:e34b77260d39cf525a837bd779b8dba2
Created April 8, 2021 06:42
certbot wildcard for multi domains
sudo certbot certonly --manual --preferred-challenges=dns-01 --email email@gmail.com --server https://acme-v02.api.letsencrypt.org/directory --agree-tos -d *.site1.com -d *.site2.net
@ascorbic-acid
ascorbic-acid / gist:8ecceb5edee6d1daba39fdefd442544c
Created March 23, 2021 07:35
wp webhooks update woocommerce order status example
// put this code in your theme functions.php
add_filter( 'wpwhpro/run/actions/custom_action/return_args', 'wpwh_fire_my_custom_logic', 10, 3 );
function wpwh_fire_my_custom_logic( $return_args, $identifier, $response_body ){
//If the identifier doesn't match, do nothing
if( $identifier == 'update_status' ){
$order_id = WPWHPRO()->helpers->validate_request_value( $response_body['content'], 'order_id' );
$new_status = WPWHPRO()->helpers->validate_request_value( $response_body['content'], 'new_status' );
$order = new WC_Order($order_id);
@ascorbic-acid
ascorbic-acid / gist:b1e97de1621f7e1849f0d8ee2ed8005c
Last active January 25, 2021 06:43
Wordpress xDebug install Ubuntu 18.04 VSCODE
sudo apt-get update
sudo apt install php-xdebug
# [7.2] path may be different on your system, check it.
sudo nano /etc/php/7.2/mods-available/xdebug.ini
Add the following code into xdebug.ini file:
zend_extension=/usr/lib/php/20151012/xdebug.so # [20151012] path may be different on your system, check it.
// the easy way to have any subdomain without the need to generate new cert or add dns record everytime is to create CNAME
for all subdomains using the * wildcard and then generate cert for all subdomain including the main domain with:
sudo certbot -d *.example.com --preferred-challenges=dns-01 --agree-tos certonly --manual