Under Manjaro (Arch), I had to do this: Figure out the value of DBUS_SESSION_BUS_ADDRESS:
echo $DBUS_SESSION_BUS_ADDRESS
crontab -e
in crontab
sudo -u YOUR_USER DISPLAY=:0 DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1001/bus notify-send "Notification Title" "Notification body"
Disclaimer
PLEASE IF YOU DON'T HAVE ANY EXPERIENCE WITH COMMAND CONSOLE DON'T TRY THIS, YOUR LINUX SYSTEM MIGHT STOP WORKINGinstall package
sudo pamac build envycontrol
switch to inte graphics card
sudo envycontrol -s integrated
sudo reboot
check working with integrated graphics if your computer doesn't show the login, try next step when force show console mode
switch to nvidia
sudo envycontrol -s hybrid --rtd 0
sudo reboot
try to use system that's way, if it doesn't work, open comand line in boot GRUB
add on line edit grub or line mark the image: the number 3
LOGIC FOR ACTIVE CONSOLE MODE AND COMPUTER DOESN'T LOAD DISPLAY OR GRAPHICS
- Example #1. This is how the line beginning with "linux" looks like for Ubuntu 18.04 LTS (it doesn't have to be identical for you, it's just so you get an idea):
- Terminal:
linux /boot/vmlinuz-4.18.0-15-generic root=UUID=1438eb20-da3d-4880-bb3a-414e+++0a929 ro quiet splash $vt_handoff
- And this is how the line beginning with "linux" looks after adding the 3 at the end:
- Terminal:
linux /boot/vmlinuz-4.18.0-15-generic root=UUID=1438eb20-da3d-4880-bb3a-414e+++0a929 ro quiet splash $vt_handoff 3
- Example #2. This is how the line beginning with "linux" looks for Fedora 31 (it's not identical for you, it's just so you get an idea):
- Terminal:
linux ($root)/vmlinuz-5.3.13-300.fc31.x86_64 root=/dev/mapper/fedora_localhost--live-root ro resume=/dev/mapper/fedora_localhost--live-swap rd.lvm.lv=fedora_localhost-live/root rd.lvm.lv=fedora_localhost-live/swap rhgb quiet
- And this is how it looks after adding the 3 at the end of the line:
- Terminal:
linux ($root)/vmlinuz-5.3.13-300.fc31.x86_64 root=/dev/mapper/fedora_localhost--live-root ro resume=/dev/mapper/fedora_localhost--live-swap rd.lvm.lv=fedora_localhost-live/root rd.lvm.lv=fedora_localhost-live/swap rhgb quiet 3
- 3. After doing this, press Ctrl + x or F10 to boot to console (text) mode.
now login with your user and password, try with this comand
sudo envycontrol -s hybrid --rtd 3
reboot computer
if this command doesn't work, try this.
sudo envycontrol -s nvidia --force-comp --coolbits 24
Source:
https://github.com/bayasdev/envycontrol
install package
sudo pacman -S downgrade
search version the package that you want
sudo downgrade obs-studio --maxdepth 20 --ala-only
--maxdepth 20: 20 result max
--ala-only: only online package, exclude local packages
Example when you will run the command
after you select the version for your package, the comand show you, this option
this helps me when i needed to update some packages:
- sudo downgrade libva --maxdepth 20 --ala-only
- yay -Qi libva
- sudo downgrade obs-studio --maxdepth 20 --ala-only
- yay -Qi obs-studio
Url: https://wiki.manjaro.org/index.php?title=Downgrading_packages
Alternative to install OBS-STUDIO:
yay -S flatpak && flatpak install flathub com.obsproject.Studio
Reference:
https://obsproject.com/forum/threads/obs-on-manjaro-linux-best-solution-so-far.158090/
sudo vim /usr/share/pulseaudio/alsa-mixer/paths/analog-input-internal-mic.conf
sudo vim /usr/share/pulseaudio/alsa-mixer/paths/analog-input-internal-mic.conf
Under "[Element Internal Mic Boost]" set "volume" to "zero".
Under "[Element Int Mic Boost]" set "volume" to "zero".
Under "[Element Mic Boost]" set "volume" to "zero".
example file: analog-input-internal-mic.conf
Source: https://askubuntu.com/a/736655
for this tutorial you need:
- docker even if you want use composer direct in your native system is valid, add a tutorial to install docker just in case.
Tutorial docker: https://docs.docker.com/engine/install/ - github account https://github.com/
- packagist account https://packagist.org/
create a folder, you must think the name package, because this is name the folder
mkdir -p query-log && cd query-log
create a package composer
sudo docker run --rm --interactive --tty --volume $PWD:/app --user $(id -u):$(id -g) \ composer composer init
now with that generator why create the package i will explain all steps and the because use that words or parameters
- Package name (<vendor>/<name>) [root/app]: cirelramos/query-log
that parameter represent cirelramos -> your name in repository github - Description []: this package has utils to send console query generate in your project laravel
your description about that package - Author [n to skip]: Cirel Ramos
your name - Minimum Stability []:
you can type dev or only press key ENTER - Package Type (e.g. library, project, metapackage, composer-plugin) []:
you can press key ENTER or type word associate to project - License []: MIT
type MIT this is a standar license to software or is recommendate license to programs open soucer - Would you like to define your dependencies (require) interactively [yes]?
press key ENTER, we will add more later is more easy that way - Would you like to define your dev dependencies (require-dev) interactively [yes]?
press key ENTER, we will add more later is more easy that way - Add PSR-4 autoload mapping? Maps namespace "Cirelramos\QueryLog" to the entered relative path. [src/, n to skip]:
press key ENTER, we will adjust the namespace - Do you confirm generation [yes]? yes
type yes and press key ENTER
okey now install a various packages
sudo docker run --rm --interactive --tty --volume $PWD:/app --user $(id -u):$(id -g) \
composer composer require "illuminate/database":"^7.20|^8.19|^9.0"
sudo docker run --rm --interactive --tty --volume $PWD:/app --user $(id -u):$(id -g) \
composer composer require "illuminate/http":"^7.20|^8.19|^9.0"
sudo docker run --rm --interactive --tty --volume $PWD:/app --user $(id -u):$(id -g) \
composer composer require "illuminate/contracts":"^7.20|^8.19|^9.0"
sudo docker run --rm --interactive --tty --volume $PWD:/app --user $(id -u):$(id -g) \
composer composer require "illuminate/config":"^7.20|^8.19|^9.0"
we add various version support to this pacakge can working different laravel version, some package dont support this, maybe require only the version that you need
now go add some parameters manually in the file composer.json:version php
"php": "^7.4|^8.0",
keyworks
"keywords": [
"laravel",
"log",
"database"
],
add your email
"authors": [
{
"name": "Cirel Ramos",
"email": "cirelramos@gmail.com"
}
],
In Laravel 5.5 and later, there is a function called auto-discovery that automatically registers ServiceProvider when it is created by itself. after we create the folder and file necessary
"extra": {
"laravel": {
"providers": [
"QueryLog\\Providers\\ServiceProvider"
]
}
}
now we create the folders and files and copy the content
mkdir -p src/Providers
mkdir -p src/Services
mkdir -p config
touch src/Providers/QueryLogProvider.php
<?php
namespace Cirelramos\QueryLog\Providers;
use Cirelramos\QueryLog\Services\SendStderrService;
use DateTime;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
/**
*
*/
class QueryLogProvider extends ServiceProvider
{
/**
* Bootstrap services.
*
* @return void
*/
public function boot(): void
{
DB::listen(static function ($query) {
if(config('query-log.query_log_is_active') === false){
return;
}
$queryBinding = '';
$sql = $query->sql;
$bindings = array_map(static function ($value) {
if ($value instanceof DateTime) {
return $value->format('Y-m-d H:i:s');
}
return $value;
}, $query->bindings);
foreach ($bindings as $binding) {
$queryBinding .= $binding . ', ';
$value = is_numeric($binding) ? $binding : "'$binding'";
$sql = preg_replace('/\?/', $value, $sql, 1);
}
$searchWords = config('query-log.exclude_log_query_by_words');
if (Str::contains($sql, $searchWords)) {
return null;
}
$sql = "time_query:".$query->time." ".$sql;
SendStderrService::execute($sql);
});
}
}
touch src/Providers/ServiceProvider.php
<?php
namespace Cirelramos\QueryLog\Providers;
/**
*
*/
class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
public function register()
{
$this->mergeConfig();
}
public function boot()
{
$this->publishConfig();
$this->publishMigrations();
}
private function mergeConfig()
{
$this->mergeConfigFrom($this->getConfigPath(), 'query-log');
}
private function publishConfig()
{
// Publish a config file
$this->publishes([ $this->getConfigPath() => config_path('query-log.php'), ], 'config');
}
private function publishMigrations()
{
// $path = $this->getMigrationsPath();
// $this->publishes([$path => database_path('migrations')], 'migrations');
}
/**
* @return string
*/
private function getConfigPath()
{
return __DIR__ . '/../../config/query-log.php';
}
/**
* @return string
*/
private function getMigrationsPath()
{
return __DIR__ . '/../database/migrations/';
}
}
touch src/Services/SendStderrService.php
<?php
namespace Cirelramos\QueryLog\Services;
use Illuminate\Support\Facades\Log;
/**
*
*/
class SendStderrService
{
/**
* @param $message
* @return void
*/
public static function execute($message): void
{
Log::debug($message);
}
}
touch config/query-log.php
<?php
return [
/*
|--------------------------------------------------------------------------
| Laravel query-log
|--------------------------------------------------------------------------
|
|
*/
/*
* exclude query by words
* example:
*
'exclude_log_query_by_words' => [
'token',
'password',
],
*/
'exclude_log_query_by_words' => [
],
];
okey now you need pay atencion these details
Files.php
<?php
namespace Cirelramos\QueryLog\XXXXXXX;
composer.json
"autoload": {
"psr-4": {
"Cirelramos\\QueryLog\\": "src/"
}
},
those path/namespace has relation between, so we go change for a word type standar camelcase, go head
Files.php
<?php
namespace CirelRamos\QueryLog\XXXXXXX;
composer.json
"autoload": {
"psr-4": {
"CirelRamos\\QueryLog\\": "src/"
}
},
ok, now we adjusted the namespace correctly
create the repository
init git
git init
git remote add origin git@github.com:cirelramos/query-log.git
*licence (change the values for you name project)
*.gitignore
add mark all files to upload for git
git add --all
add message to commit and set all files to temp loca git
git commit -m "first commit"
upload all changes to branch master
git push origin master
now upload this project in https://packagist.org/packages/submit
check the create package and press create
okey when the load is finish, you can see the version that manage your project
the version is dev-master so how create versions as other packages composer?, it is very easy, go your terminal/console and run those commands
create the tag version and push tag version
git tag 1.0.1 && git push --tags
list all tag's version
git tag --list
you will see the new version
if you want create other version, first upload the files with workflow normally git and after run the comand to create version tag and push tag
link the repository for this tutorial
https://github.com/cirelramos/query-log