Skip to content

Instantly share code, notes, and snippets.

🎯
He is trying to focus :)

Emre Saracoglu emresaracoglu

🎯
He is trying to focus :)
Block or report user

Report or block emresaracoglu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@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 / 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 / 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 / gist:35e0181b42aadd118862ee253fa69343
Created May 9, 2017 — forked from erikjung/gist:3079806
PHP 5.4 Namespace-based Autoloader
View gist:35e0181b42aadd118862ee253fa69343
<?php
// Probably unnecessary, but wanted to test the waters of 5.4
trait NamespaceConverter
{
function nsToPath($class) {
return str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';
}
}
@emresaracoglu
emresaracoglu / Autoloader.php
Created May 8, 2017 — forked from Nilpo/Autoloader.php
A simple recursive PHP autoloader using the RecursiveDirectoryIterator.
View Autoloader.php
<?php
/*
* The MIT License (MIT)
*
* Copyright (c) 2014 Rob Dunham
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
@emresaracoglu
emresaracoglu / download.php
Created May 4, 2017 — forked from brasofilo/download.php
Force File Download with PHP
View download.php
<?php
/*
* Foce File Download
* Usage: http://example.com/download.php?file=./uploads/image.jpg
*
* There are a couple of *ninja* exit() as security guarantee, adapt as necessary
*
*/
// grab the requested file's name
@emresaracoglu
emresaracoglu / php-ping.php
Created Oct 7, 2016 — forked from k0nsl/php-ping.php
PHP ping script
View php-ping.php
<?php
/*
*
* Use the examples below to add your own servers. Coded by clone1018 [?]
*
*/
$title = "Simple Server Status"; // website's title
$servers = array(
'Google Web Search' => array(
View gist:596813b450251818e79505b390cd8836
Installing Redis on clean CentOS.
Pre installation Redis
#update and upgrade the linux
yum -y update
yum -y upgrade
#I like nano
@emresaracoglu
emresaracoglu / browser.html
Created Sep 20, 2016 — forked from panslaw/browser.html
Javascript to find browser version, os version and os bit version
View browser.html
<html>
<body>
<script type="text/javascript">
var BrowserDetect = {
init: function () {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent)
|| this.searchVersion(navigator.appVersion)
|| "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
@emresaracoglu
emresaracoglu / FlxZipArchive.class.php
Created Sep 20, 2016 — forked from panslaw/FlxZipArchive.class.php
Extended ZipArchive - simply way to create zip with subdirectories
View FlxZipArchive.class.php
<?php
class FlxZipArchive extends ZipArchive
{
/**
* Add a Dir with Files and Subdirs to the archive
*
* @param string $location Real Location
* @param string $name Name in Archive
You can’t perform that action at this time.