Skip to content

Instantly share code, notes, and snippets.

View aliemre's full-sized avatar
🎯
Focusing

Ali Emre Çakmakoğlu aliemre

🎯
Focusing
  • Webridge
  • İzmir / Türkiye
View GitHub Profile
@aliemre
aliemre / htaccess-auth
Last active August 29, 2015 13:56
Htaccess Authentication
.htaccess
-----------------
AuthType Basic
AuthName "Mendil Sepeti"
AuthUserFile /home/mendil/public_html/.htpasswd
Require valid-user mendilsepeti
.htpasswd
-----------------
mendilsepeti:$apr1$2iqpc0as$8biTnaAMhrUK0yBTmvleb.
@aliemre
aliemre / response.php
Created February 8, 2016 00:31
Download / Show Headers for Symfony2
$response = new Response();
$response->headers->set('Cache-Control', 'private');
$response->headers->set('Content-type', mime_content_type($image));
$response->headers->set('Content-length', filesize($image));
$response->headers->set('Content-Disposition', 'attachment; filename="' . basename($image) . '";');
$response->sendHeaders();
$response->setContent(readfile($image));
@aliemre
aliemre / soap_service.php
Created April 9, 2016 13:08
The Service
<?php
namespace System\ReportBundle\Service;
use Doctrine\ORM\EntityManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
class TYHWebService
{
/**
@aliemre
aliemre / timezone.php
Created July 2, 2016 16:46
Symfony Form Choise Type Timezone
<?php
$builder
->add('cargoLRDTimezone', ChoiceType::class, [
'label' => "Cargo LRD",
'placeholder' => "Seçiniz..",
'choices' => [
'CST' => "CST (Central Standard Time)",
'CET' => "CET (Central European Time)",
'CEST' => "CEST (Central European Summer Time)",
@aliemre
aliemre / mysql.txt
Created November 8, 2016 11:37
MySQL Reset Expired Password
mysql -u usename -p
mysql > SET PASSWORD = PASSWORD('your_new_password');
@aliemre
aliemre / libvips.so.42.txt
Created February 1, 2018 11:54
Error: libvips.so.42: cannot open shared object file
I was able to resolve the issue by following these steps.
Added usrlocal.conf file with following line into /etc/ld.so.conf.d
/usr/local/lib
Then ran ldconfig -v as root upon save
Thank you very much for the help.
@aliemre
aliemre / bulk-file-to-zip.php
Created March 6, 2018 07:52
Bulk File Download Within Zip In Symfony
<?php
public function exAction(Request $request)
{
clearstatcache();
$em = $this->getDoctrine()->getManager();
$responseData = [];
$files = [];
@aliemre
aliemre / composer-swap-memory.sh
Last active August 22, 2023 00:41
Make a Swap and Remove a Swap
# Swap Yaratmak
df -h
sudo dd if=/dev/zero of=/swapfile bs=1k count=2048k
sudo mkswap /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo 'echo "/swapfile none swap defaults 0 0" >> /etc/fstab' | sudo sh
free -m
@aliemre
aliemre / aws-linux-ami-2.sh
Last active May 10, 2020 22:15
Amazon Linux AMI 2 Installations
# MySQL
sudo yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
sudo yum install mysql-community-server
# MySQL Root Password
sudo grep "temporary password" /var/log/mysqld.log
# Nginx
@aliemre
aliemre / permission-fix.txt
Created November 30, 2019 15:25
Nginx (13: Permission denied) while connecting to upstream
$ setsebool -P httpd_can_network_connect 1
Source: https://stackoverflow.com/questions/23948527/13-permission-denied-while-connecting-to-upstreamnginx