Skip to content

Instantly share code, notes, and snippets.

View onurguven's full-sized avatar
🎯
Focusing

Onur onurguven

🎯
Focusing
View GitHub Profile
@onurguven
onurguven / InjectMediaUrlsListener.php
Created December 2, 2018 21:26 — forked from OskarStark/InjectMediaUrlsListener.php
If you need to get the SonataMedia public urls exposed through the api
<?php
namespace Application\Sonata\MediaBundle\Listener;
use Application\Sonata\MediaBundle\Entity\Media;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Sonata\MediaBundle\Provider\MediaProviderInterface;
use Sonata\MediaBundle\Provider\Pool;
use Symfony\Component\DependencyInjection\ContainerInterface;
@onurguven
onurguven / php
Created April 2, 2018 08:03
smart tv user agent
<?php
function is_smarttv()
{
$user_agent = strtolower($_SERVER['HTTP_USER_AGENT']);
if (strpos($user_agent, 'smart-tv') !== false) {
return true;
} elseif (strpos($user_agent, 'smarttv') !== false) {
return true;
} elseif (strpos($user_agent, 'tv') !== false) {
return true;
@onurguven
onurguven / WP_Query.php
Last active January 20, 2018 01:05 — forked from Dimasmagadan/WP_Query.php
#WordPress query with args
$args = array(
//Author Parameters - Show posts associated with certain author.
'author' => '1,2,3,'
'author_name' => 'luetkemj',
'author__in' => array( 2, 6 ),
'author__not_in' => array( 2, 6 ),
//Category Parameters - Show posts associated with certain categories.
'cat' => 5,
# Logs #
######################
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# OS generated files #
{
"ignored_packages" :
[
"Vintage"
],
// THEME OPTIONS
"icon_file_type_enable" : true,
"centurion_folder_icons": true,
@onurguven
onurguven / apache_vhost.sh
Created January 25, 2016 10:25
CentOS 7 bash script to i create virtual host vhost with apache httpd
#!/bin/bash
# This script is used for create virtual hosts on CentOs.
# Feel free to modify it
# PARAMETERS
#
# $usr - User
# $dir - directory of web files
# $servn - webserver address without www.
# $cname - cname of webserver
# EXAMPLE
@onurguven
onurguven / vsftpd_virtual_config.sh
Last active February 19, 2017 16:17
CentOS 7 bash script to install vsFTPd with PAM
#!/bin/bash
#------------------------------------------------------------------------------------
# Install vsFTPd
#------------------------------------------------------------------------------------
yum install -y vsftpd libdb4-utils
systemctl enable vsftpd.service
@onurguven
onurguven / vsftpd_virtualuser_add.sh
Created January 25, 2016 08:59
CentOS 7 bash script to create vsftpd user
#!/bin/bash
#------------------------------------------------------------------------------------
# Initialize some variables
#------------------------------------------------------------------------------------
SHELL=/sbin/nologin
FTPCONF=/etc/vsftpd
HOMEDIR=/var/www