Skip to content

Instantly share code, notes, and snippets.

View AndreiTelteu's full-sized avatar

Andrei Telteu AndreiTelteu

View GitHub Profile
@AndreiTelteu
AndreiTelteu / aapanel install mysql
Last active July 20, 2022 16:07
aapanel instal mysql
cd /www/server/panel/install
bash ./install_soft.sh 1 install mysql mariadb_10.4
bash ./install_soft.sh 1 install openlitespeed 1.7
@AndreiTelteu
AndreiTelteu / Backpack export operation (excel and csv) .md
Last active October 4, 2022 17:58
Export operation for backpack admin panel, that exports the entire database table, not just the entries shown on page
  1. First install maatwebsite/excel package:
composer require maatwebsite/excel
  1. Copy export.blade.php from this gist in resources/views/vendor/backpack/crud/buttons/export.blade.php

  2. Copy ExportOperation.php from this gist in app/Traits/Operations/ExportOperation.php

@AndreiTelteu
AndreiTelteu / # - Jitsi meet - easy setup with custom config .md
Last active February 4, 2024 01:36
Jitsi meet - easy setup with custom config - customizations are: removed all branding, removed every unnecesary button
@AndreiTelteu
AndreiTelteu / Manual export inline with maatwebsite excel laravel package .md
Last active February 6, 2022 12:22
How to export/import in excel format with maatwebsite/excel using inline anonymous class, without any external files #laravel

Using this plugin: maatwebsite/excel

composer require maatwebsite/excel

You can use this anywhere in your app.

<?php
@AndreiTelteu
AndreiTelteu / PHP opcache invalidate entire directory .md
Last active January 25, 2022 15:20
How to invalidate an entire directory with opcache, also in a laravel middleware
<?php
$directories = [
    'absolute/path/to/dir',
    'multiple/dirs/if/needed',
];
$extensions = [
    'php',
];
function invalidateDirectory($dir) {
@AndreiTelteu
AndreiTelteu / aaPanel howto install latest swoole version .md
Last active November 28, 2021 18:23
How to install swoole v4.8.2 on aapanel with php 8.0

As a root user, download this script and put it in /www/server/panel/install/modified-swoole-install.sh

cd /www/server/panel/install/
wget https://gist.githubusercontent.com/AndreiTelteu/c92ef2414cc97e2c76f539cc988652d0/raw/abf316cd872ad75be34ce5572bb7ff3dac6819ce/modified-swoole-install.sh
chmod +x modified-swoole-install.sh
bash modified-swoole-install.sh install 80
@AndreiTelteu
AndreiTelteu / How to install vs code server and setup supervisor with fnm .md
Last active February 6, 2022 15:44
Install vs code-server with fnm and yarn, and keep it runing always with supervisor (on ubuntu)

Install build requirements (python3 and build essential)

sudo apt-get install -y build-essential pkg-config python3

Install fnm to manage multiple nodejs versions (uninstall nodejs or nvm if you have it installed)

curl -fsSL https://fnm.vercel.app/install | bash

If you use a ecosystem file, add the following lines to your app:

      interpreter: '/home/forge/.fnm/fnm',
      interpreter_args: 'exec --using=14 node',

14 is the node version. You can be more specific like --using=12.22.4

Example configuration:

@AndreiTelteu
AndreiTelteu / Reboot server is the average load is greater than x .md
Last active November 5, 2021 11:12
Bash script to restart the server if the load is greater than x

Put the following script in a .sh file, for example in /root/reboot-load.sh.

#!/usr/bin/bash
LOAD=`uptime |awk '{print $NF}'`
LOADCOMP=`echo "($LOAD * 100) / 1" | bc`
echo "Load is: $LOAD"
if [[ $LOADCOMP -ge 2000 ]]
then echo "Greater than 20 ! Reboot !"
fi
useIpInProxyHeader 2
accessControl {
allow ALL, 173.245.48.0/20T, 103.21.244.0/22T, 103.22.200.0/22T, 103.31.4.0/22T, 141.101.64.0/18T, 108.162.192.0/18T, 190.93.240.0/20T, 188.114.96.0/20T, 197.234.240.0/22T, 198.41.128.0/17T, 162.158.0.0/15T, 104.16.0.0/13T, 104.24.0.0/14T, 172.64.0.0/13T, 131.0.72.0/22T
}