Skip to content

Instantly share code, notes, and snippets.

View kirilkirkov's full-sized avatar
👽
writing alien code..

Kiril Kirkov kirilkirkov

👽
writing alien code..
View GitHub Profile
@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 / numerous_systems.bin
Last active October 10, 2024 05:59
Как работят бройните системи
------------Преобразуване от двоична(binary) в десетична (decimal) бройна система (numeric system):------------
01010101 - Имаме това двойчно бройно число
76543210 - Изброяваме го в обратен ред
2(7)2(6)2(5)2(4)2(3)2(2)2(1)2(0) - Степенуваме 2(тъй като ще преобразуваме от двойчна система) по всяко от позицийте
128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 - Това е резултата
0 + 64 + 0 + 16 + 0 + 4 + 0 + 1 - Събираме всички получени числа които отговарят на единица(1) в бинарното число.
85 - полученият резултат е в десетичен вариант.
* Всяко степенуване по 0 е = 1;
@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 / auth_basic.php
Last active October 10, 2024 06:00
Auth Digest And Basic. Digest Authentication communicates credentials in an encrypted form. Whereas Basic Authentication uses non-encrypted base64 encoding.
<?php
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My Realm"');
header('HTTP/1.0 401 Unauthorized');
echo 'Text to send if user hits Cancel button';
exit;
} else {
$headers = apache_request_headers(); // Also can be viewed in apache request
echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
@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(
@kirilkirkov
kirilkirkov / DER vs. CRT vs. CER vs. PEM Certificates and How To Convert Them
Created March 17, 2020 15:21
DER vs. CRT vs. CER vs. PEM Certificates and How To Convert Them
https://support.ssl.com/Knowledgebase/Article/View/19/0/der-vs-crt-vs-cer-vs-pem-certificates-and-how-to-convert-them
Certificates and Encodings
At its core an X.509 certificate is a digital document that has been encoded and/or digitally signed according to RFC 5280.
In fact, the term X.509 certificate usually refers to the IETF’s PKIX Certificate and CRL Profile of the X.509 v3 certificate standard, as specified in RFC 5280, commonly referred to as PKIX for Public Key Infrastructure (X.509).
X509 File Extensions
@kirilkirkov
kirilkirkov / PaginationModule.js
Last active January 30, 2020 11:47
JS Pagination Class Module for Vuejs Components
export default class Pagination {
constructor(vm, limit, total, page_param_name) {
this.vm = vm
this.limit = parseInt(limit)
this.total = parseInt(total)
this.page_param_name = page_param_name
this.setMaxPagesToShow(5)
this.setDefaultStyles()
<?php
$url = 'https://valkata.lulin';
$proxyList = ['186.47.82.6:41430', '43.240.5.1:31777', '202.166.201.65:23500'];
$browserAgents = [
'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36',
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36',
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36',
];
@kirilkirkov
kirilkirkov / install_GoDaddy_SSL
Created February 27, 2018 10:06
Installing GoDaddy SSL Certificate in an Ubuntu Server
There are a lot of guides out there that deals with this topic (installing ssl certificate)
but not much that are actually tailored for this pair, GoDaddy and Ubuntu. So hopefully today’s
article will be helpful for many people.
Elements
Basically in order to successfully install an SSL certificate you need the following things
CSR file
Private key
Certificate key
@kirilkirkov
kirilkirkov / Fix Ugly Fonts in Netbeans under Linux
Created February 13, 2018 20:45
Fix Ugly Fonts in Netbeans under Linux
To enable anti-aliased fonts just for Netbeans, add -J-Dawt.useSystemAAFontSettings=on to the end of the netbeans_default_options line in /usr/share/netbeans/etc/netbeans.conf e.g.:
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dawt.useSystemAAFontSettings=on"
Alternatively, you can set this globally so that all AWT apps are affected, by setting the _JAVA_OPTIONS environment variable in your .bash_profile:
export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true'
This also has Swing equivalent, using the swing.aatext preference. You'll have to log out and log back in for this to take effect.