Skip to content

Instantly share code, notes, and snippets.

View aceraven777's full-sized avatar

Aristheo Lacdao aceraven777

View GitHub Profile
#!/bin/bash
while true
do
export DISPLAY=:0.0
battery_level=`cat /sys/class/power_supply/BAT0/capacity`
battery_status=`cat /sys/class/power_supply/BAT0/status`
if [ $battery_status = "Charging" ] && [ $battery_level -ge 80 ];
then
notify-send -u critical "Battery at 80%."
fi
@aceraven777
aceraven777 / 01-setup.txt
Last active July 20, 2023 02:38
Setup Server (PHP, nginx, SSL, supervisord, beanstalkd)
sudo su
# Set local timezone
timedatectl set-timezone Asia/Manila
yum update -y
# Search for nginx package
amazon-linux-extras | grep nginx
@aceraven777
aceraven777 / setup.txt
Created July 20, 2023 02:35
Setup Server (own Websocket)
sudo su
# WEBSOCKET START
# Install PHP 7.4. you can use 'php74' command
yum groupinstall -y "Development Tools"
yum install -y php74
yum install -y php74-php-xml php74-php-mbstring php74-php-pear php74-php-devel
# Install ev extension to open connection limit (this will override the default system 1024 concurrent limit connection)
/opt/remi/php74/root/usr/bin/pecl install ev
@aceraven777
aceraven777 / NodeIndexNid.php
Created January 19, 2022 03:33 — forked from StryKaizer/NodeIndexNid.php
Exposed filters for entity references -> nodes. Port from TaxonomyIndexTid.php
<?php
namespace Drupal\yourmodule\Plugin\views\filter;
use Drupal\Core\Entity\Element\EntityAutocomplete;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\node\Entity\Node;
use Drupal\node\NodeStorageInterface;
use Drupal\views\ViewExecutable;
@aceraven777
aceraven777 / .htaccess
Created July 4, 2019 07:37
Laravel .htaccess file if you can't change the document root
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
RewriteCond %{HTTP_HOST} !^dashboard.liveablecities.ph$ [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST} [L,R]
{
"settings": {
"search.exclude": {
"vendor": true,
"node_modules": true
},
"files.watcherExclude": {
"vendor": true,
"node_modules": true
}
{
"search.exclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/**": true
},
"files.exclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/**": true
@aceraven777
aceraven777 / outside-div-click-event.js
Created April 17, 2019 03:00
jQuery - If you want to get the clicked element that is outside of a div / section
$(document).on('click', function (e) {
var $clicked = $(e.target);
if ($clicked == $('header') || $clicked.parents('header').length) {
return;
}
// Your code here
});
@aceraven777
aceraven777 / laravel-useful-packages.txt
Created June 18, 2018 09:36
Laravel Useful Packages
barryvdh/laravel-debugbar
proengsoft/laravel-jsvalidation
laravelcollective/html
intervention/image
@aceraven777
aceraven777 / psr.php
Last active April 17, 2019 03:01
PSR Coding Guide
<?php
namespace App\Http\Controllers;
use Library1;
use Library2;
use Library3;
use Library4;
class ClassName extends ParentController