Skip to content

Instantly share code, notes, and snippets.

View wyyr's full-sized avatar

Low wyyr

  • Indonesia
View GitHub Profile
@wyyr
wyyr / fixpm2aapanel
Created February 1, 2022 14:20 — forked from derakula/fixpm2aapanel
Fix PM2 Manager empty after server restart on AAPANEL
> /etc/systemd/system/pm2-undefined.service
Change User=undefined
To User=root
> /www/server/panel/plugin/pm2/pm2_main.py
change 'pm2 save && pm2 startup'
to 'pm2 cleardump && pm2 save && pm2 startup -u root'
@wyyr
wyyr / Dockerfile
Created January 29, 2022 06:03
Gitlab CI/CD Dockerfile with Laravel Envoy
# Set the base image for subsequent instructions
FROM php:7.4
# Update packages
RUN apt-get update
# Install PHP and composer dependencies
RUN apt-get install -qq git curl libmcrypt-dev libjpeg-dev libpng-dev libfreetype6-dev libbz2-dev libicu-dev zip
# Clear out the local repository of retrieved package files
@wyyr
wyyr / countries.sql
Created April 15, 2021 13:59 — forked from adhipg/countries.sql
Sql dump of all the Countries, Country Codes, Phone codes.
CREATE TABLE IF NOT EXISTS `country` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`iso` char(2) NOT NULL,
`name` varchar(80) NOT NULL,
`nicename` varchar(80) NOT NULL,
`iso3` char(3) DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
`phonecode` int(5) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@wyyr
wyyr / upload.js
Created March 7, 2021 13:25 — forked from virolea/upload.js
Tracking file upload progress using axios
upload(files) {
const config = {
onUploadProgress: function(progressEvent) {
var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total)
console.log(percentCompleted)
}
}
let data = new FormData()
data.append('file', files[0])
@wyyr
wyyr / laravel-queue-worker.pm2.yml
Created February 23, 2021 06:23 — forked from vector-kerr/laravel-queue-worker.pm2.yml
Laravel Queue Worker PM2 Application Definition
#
# This file provides an application definition that can be used with
# PM2 ("Production Process Manager").
#
# PM2 "allows you to keep applications alive forever, to reload them
# without downtime and to facilitate common system admin tasks."
#
# Use this file by running it with PM2. For example:
# $> pm2 start laravel-queue-worker.pm2.yml
#
required packages:
networkmanager networkmanager-l2tp libreswan
# IPsec Settings
Enable IPsec tunnel to L2TP host => Pre-shared key
enable Enforce UDP encapsulation
(only if not working):
#Phase 1 : 3des-sha1-modp1024
#Phase 2 : 3des-sha1
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
# nginx.conf
#user html;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
https://laracasts.com/discuss/channels/laravel/query-builder-how-to-retrieve-records-for-every-date-in-range-even-if-data-is-not-there-for-some-dates
// retrieve all dates even if they are empty.
$dates = [];
$period = new DatePeriod(new DateTime('2020-05-01'), new DateInterval('P1D'), new DateTime('2020-05-03 +1 day'));
foreach ($period as $date) {
$dates[] = $date->format("Y-m-d");
}
var_dump($dates);
// output : ["2020-05-01","2020-05-02","2020-05-03"]