Skip to content

Instantly share code, notes, and snippets.

View kirilkirkov's full-sized avatar
🎯
Focusing

Kiril Kirkov kirilkirkov

🎯
Focusing
View GitHub Profile
@kirilkirkov
kirilkirkov / gist:fc6e20f9cee38031753d3828386f23f8
Created August 28, 2022 07:25
JavaScript - Destructuring To Get The First And Last Element Of An Array In ES6
The easiest lay to get first and last element from an array in javascript with one line code.
<script>
const meals = ['apple', 'orange', 'bananna'];
const {length, 0: first, [length - 1]: last} = meals;
console.log(first, last)
</script>
@kirilkirkov
kirilkirkov / Kali-Linux-MacBook-Air-2017-Wifi-Drivers
Last active July 17, 2022 06:05
How to use MacBook Air 2017 - WiFi broadcom default wifi adapter on Kali Linux 2022.2
sudo apt-get update
sudo apt install broadcom-sta-dkms
sudo modprobe -r b43 ssb wl
sudo modprobe wl
This will enable you wifi ;) Enjoy!
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const isDevelopment = true
const autoprefixer = require('autoprefixer');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: {
app: './resources/js/entry-server.js',
},
mode: isDevelopment ? 'development' : 'production',
@kirilkirkov
kirilkirkov / gist:dcc281f642c179df608e04c24dedbeb6
Created February 27, 2022 07:48
When is admin_init Action ran?
admin_init is triggered when a user accesses the admin area. It is the first hook to be triggered. It can be used in cases like:
We want to block access to the admin panel for users that do not have the Administrator Role.
We want automatic redirection of users lacking the specified capability, to the homepage.
We want to register a new setting for use by a plugin.
@kirilkirkov
kirilkirkov / Macbook Pro Dev PHP APACHE (5.6, 7.4, 8.0)
Last active October 27, 2021 19:50
Mac installation of php 5.6 and others - Big Sure, Mojave, Monterey .. etc.
Origin source: https://getgrav.org/blog/macos-bigsur-apache-multiple-php-versions
Brew packages - https://github.com/shivammathur/homebrew-php
Part 1: macOS 11.0 Big Sur Web Development Environment
Developing web applications on macOS is a real joy. There are plenty of options for setting up your development environments, including the ever-popular MAMP Pro that provides a nice UI on top of Apache, PHP and MySQL. However, there are times when MAMP Pro has slow downs, or out of date versions, or is simply behaving badly due to its restrictive system of configuration templates and non-standard builds.
It is times like these that people often look for an alternative approach, and luckily there is one, and it is relatively straight-forward to setup.
In this blog post, we will walk you through setting up and configuring Apache 2.4 and multiple PHP versions. In the second blog post in this two-post series, we will cover MySQL, Apache virtual hosts, APC caching, and Xdebug installation.
@kirilkirkov
kirilkirkov / gist:364d7247aef1c15abf7bc432689b22a1
Last active May 16, 2021 20:30
Udemy course video downloader
https://github.com/r0oth3x49/udemy-dl
1. If has error:
ModuleNotFoundError: No module named 'm3u8'
-- Run this: pip install -r requirements.txt
2. If has error:
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020.
@kirilkirkov
kirilkirkov / Create_IPhone_Custom_Free_RingTones
Created May 29, 2020 17:22
Curtom ringtones for iPhone for free
Download from https://www.zedge.net/ringtones/
Drag and drop to ITunes - Library -> Songs
Click on it and then click File (at TOP - Left right of the macbook)
Click convert and Create ACC
Right click on the new file in Itunes and click Open in Finder
Copy the file to the Downloads directory (for example)
Edit m4a file and make it with extension - m4r
Open Finder and click on the Iphone in the Locations
In general tab drag and drop the new .m4r file.
Click Sync.
@kirilkirkov
kirilkirkov / gist:bc09c2ca5879abe3dc08491bdf1a4ba9
Last active April 2, 2020 13:39
PHP 7.2 V8JS Installation on Ubuntu 18
# Install required dependencies
sudo apt-get install build-essential curl git python libglib2.0-dev
cd /tmp
# Install depot_tools first (needed for source checkout)
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=`pwd`/depot_tools:"$PATH"
# Download v8
@kirilkirkov
kirilkirkov / nginx-504_gateway_time-out
Created March 25, 2020 15:02
Nginx and php-fpm: upstream timed out / failed (110: Connection timed out or reset by peer) while reading
You may receive a response such as this when running Nginx and php-fpm after a fixed amount of time (default = 60s).
Connection timed out
[error] upstream timed out (110: Connection timed out) while reading upstream, client: x.x.x.x, server: host.tld, request: "POST /script.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", ...
The “Connection timed out” usually happens when running large scripts, that need a lot of time for processing – such as import jobs parsing large XML or CSV files. The problem is that Nginx waits by default for 60s on the fastCGI response. If it takes too long, the request is stopped. The “Connection timed out” error means that Nginx hit a timeout before it received a response from the FastCGI backend.
You can change the time Nginx waits for the FastCGI backend, by changing the fastcgi_read_timeout parameter in the general nginx.conf.
@kirilkirkov
kirilkirkov / generate_jwt.php
Last active February 17, 2021 17:54
Generate and Validate JWT Token. Its EASY!
<?php
// RFC base64 encode - https://tools.ietf.org/html/rfc7515#appendix-C
$secret = 'kiro';
// Make base64 valid for url's
function base64UrlEncode($text)
{
return str_replace(