Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
He is trying to focus :)

Emre Saracoglu emresaracoglu

🎯
He is trying to focus :)
View GitHub Profile
@emresaracoglu
emresaracoglu / db-connect-test.php
Created Dec 2, 2017 — forked from M165437/db-connect-test.php
Script for a quick PHP MySQL DB connection test.
View db-connect-test.php
<?php
# Fill our vars and run on cli
# $ php -f db-connect-test.php
$dbname = 'name';
$dbuser = 'user';
$dbpass = 'pass';
$dbhost = 'host';
$link = mysqli_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
@emresaracoglu
emresaracoglu / curl-post.php
Created May 12, 2018 — forked from lesstif/curl-get.php
PHP CURL POST example
View curl-post.php
<?php
class Log {
public static function debug($str) {
print "DEBUG: " . $str . "\n";
}
public static function info($str) {
print "INFO: " . $str . "\n";
}
public static function error($str) {
@emresaracoglu
emresaracoglu / nginx-tuning.md
Created Jun 10, 2018 — forked from denji/nginx-tuning.md
NGINX tuning for best performance
View nginx-tuning.md

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@emresaracoglu
emresaracoglu / Encryption.js
Created Jun 28, 2020 — forked from ve3/Encryption.js
Encrypt and decrypt between programming languages (PHP & JavaScript).
View Encryption.js
/**
* Encryption class for encrypt/decrypt that works between programming languages.
*
* @author Vee Winch.
* @link https://stackoverflow.com/questions/41222162/encrypt-in-php-openssl-and-decrypt-in-javascript-cryptojs Reference.
* @link https://github.com/brix/crypto-js/releases crypto-js.js can be download from here.
*/
class Encryption {
View HAproxy File
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
View gist:46271cfd25a64930db06ffb4aaa3526d
## install
yum install zeromq-devel
## install zmq.so
cd ~
git clone https://github.com/zeromq/php-zmq.git
cd php-zmq
phpize && ./configure
make && make install