Skip to content

Instantly share code, notes, and snippets.

View marinsagovac's full-sized avatar

Marin Sagovac marinsagovac

View GitHub Profile
@marinsagovac
marinsagovac / Gearman PHP 7
Last active January 1, 2018 19:02
Gearman PHP 7
=== Install Gearman ===
sudo add-apt-repository -y ppa:ondrej/php
sudo apt-get update
sudo apt-get -y install php7.0 php7.0-fpm php-gearman
sudo touch /var/log/gearmand.log
sudo chmod 0666 /var/log/gearmand.log
gearmand -d
@marinsagovac
marinsagovac / Elasticsearch tutorials
Last active April 25, 2018 09:21
Elasticsearch tutorials
=== ElasticSearch ===
Install DEB package from: https://www.elastic.co/downloads/elasticsearch
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.1.1.deb
dpkg -i https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.1.1.deb
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
sudo apt-get -y install oracle-java8-installer
java -version
@marinsagovac
marinsagovac / Docker
Last active January 2, 2018 15:18
Docker
=== Install ===
=== Prepare Docker ===
sudo apt-get install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
41 stable"
sudo apt-get install docker-ce
@marinsagovac
marinsagovac / Apache Kafka
Last active July 14, 2021 02:28
Apache Kafka
=== Java install ===
java zookeeper-3.4.10.jar
sudo apt-add-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt install oracle-java8-set-default
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
sudo update-alternatives --config java
sudo update-alternatives --config javac
@marinsagovac
marinsagovac / Mailhog + Symfony 3
Last active March 29, 2021 19:37
Mailhog + Symfony 3
$message = \Swift_Message::newInstance()
->setSubject('Hello Email')
->setFrom('[email protected]')
->setTo('[email protected]')
->setBody('You should see me from the profiler!')
;
$this->get('mailer')->send($message);
@marinsagovac
marinsagovac / Redis Ubuntu PHP
Created January 18, 2018 10:19
Redis Ubuntu PHP
# Install Redis
sudo apt-get install redis-server
sudo apt-get install php-redis
sudo nano /etc/redis/redis.conf
Edit:
maxmemory 128mb
@marinsagovac
marinsagovac / API Platform Tests
Last active January 30, 2021 16:50
API Platform Tests
API PLATFORM
https://api-platform.com
https://github.com/api-platform/api-platform
### Install ###
composer create-project api-platform/api-platform bookshop-api
bin/console doctrine:database:create
bin/console server:run
@marinsagovac
marinsagovac / gist:75718e0099b3e15628a11a1dfcb5f896
Created January 25, 2018 16:14
API Platform / generated from Schema.org
<?php
declare(strict_types=1);
namespace AppBundle\Entity;
use ApiPlatform\Core\Annotation\ApiProperty;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
@marinsagovac
marinsagovac / Symfony JWT implementation
Last active January 26, 2018 12:53
Symfony JWT implementation
Ref: https://github.com/lexik/LexikJWTAuthenticationBundle
composer require lexik/jwt-authentication-bundle
Register in AppKernel:
public function registerBundles()
{
return array(
// ...
@marinsagovac
marinsagovac / event.php
Created February 14, 2018 14:17
PHP TCP Server example
<?php
$serv=stream_socket_server("tcp://0.0.0.0:8000",$errno,$errstr) or die("create server failed");
$base = event_base_new();
$event = event_new();
function read_cb($socket, $flag, $base) {
fread($socket);
fwrite("hello world\n");
}