Skip to content

Instantly share code, notes, and snippets.

View AndreiTelteu's full-sized avatar

Andrei Telteu AndreiTelteu

View GitHub Profile

You can follow microsoft's official instalation steps, however if you have multiple php instalations (I have php7.4 and 7.3 installed on my laravel forge server) you need to specify what version to build the extension with.

# make sure you have this installed:
sudo apt-get install -y unixodbc-dev

# elevate as root
sudo su
pecl -d php_suffix=7.3 install sqlsrv
pecl -d php_suffix=7.3 install pdo_sqlsrv
@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 June 20, 2025 07:26
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