Skip to content

Instantly share code, notes, and snippets.

View fridzema's full-sized avatar

Robert Fridzema fridzema

View GitHub Profile
@fridzema
fridzema / laravel-octane-on-forge.md
Last active May 8, 2024 06:32
Laravel octane(swoole) on forge / ubuntu server

Laravel

Configure octane laravel/octane

Server

PHP

Install swoole extension (place in corresponding .ini file(s)):

pecl install swoole
$schema = collect(DB::connection()->getDoctrineSchemaManager()->listTableNames())->map(function ($item, $key) {
return [
'name' => $item,
'colomns' => DB::getSchemaBuilder()->getColumnListing($item)
];
});
@fridzema
fridzema / query.sql
Created May 15, 2020 13:45 — forked from reinink/query.sql
Text search across multiple tables using MySQL
select
first_name,
last_name
from
users
left join
companies on companies.id = users.company_id
where (
companies.name like 'TERM%' or
first_name like 'TERM%' or
public function generateRelationsQuery($request, $db_query, $model, $filter_relations)
{
$filter_appends = [];
foreach ($filter_relations as $key => $value) {
if (!isset($value['custom_query'])) {
if ($request->has('filter-remote-' . strtolower($key))) {
$select_value = $request->input('filter-remote-' . strtolower($key));
if (!empty($select_value)) {
$filter_appends['filter-remote-' . strtolower($key)] = $select_value;
$tables = collect(Schema::getAllTables())->pluck('Tables_in_pmp');
$softdeletes = [];
foreach ($tables as $table) {
if (Schema::hasColumn($table, 'deleted_at')) {
$softdeletes[$table] = DB::table($table)->whereNotNull('deleted_at')->count();
}
}
@fridzema
fridzema / system-info.sh
Last active November 7, 2019 11:25
system-info
#!/bin/bash
# Sample script written for Part 4 of the RHCE series
# This script will return the following set of system information:
# -Hostname information:
echo -e "\e[31;43m***** HOSTNAME INFORMATION *****\e[0m"
hostnamectl
echo ""
# -File system disk space usage:
echo -e "\e[31;43m***** FILE SYSTEM DISK SPACE USAGE *****\e[0m"
@fridzema
fridzema / ubuntu-maintenance.sh
Last active November 7, 2019 13:12
maitenance
#!/bin/bash
sudo apt-get autoremove -y;
sudo apt-get autoclean -y;
sudo updatedb;
sync; echo 1 > /proc/sys/vm/drop_caches
sudo reboot -h now;
@fridzema
fridzema / bash-terminal-colors-for-loop.sh
Created November 7, 2019 11:04
bash-terminal-colors-for-loop.sh
declare -A colors
#curl www.bunlongheng.com/code/colors.png
# Reset
colors[Color_Off]='\033[0m' # Text Reset
# Regular Colors
colors[Black]='\033[0;30m' # Black
colors[Red]='\033[0;31m' # Red
colors[Green]='\033[0;32m' # Green