Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View hkulekci's full-sized avatar
⛰️
Remote

Haydar KÜLEKCİ hkulekci

⛰️
Remote
View GitHub Profile
@hkulekci
hkulekci / nginx-kibana.conf
Last active October 19, 2022 05:52 — forked from dmajorel/nginx-kibana.conf
Nginx configuration for Kibana-ElasticSearch read-only/read-write access
upstream elasticsearch_upstream {
server 10.10.10.10:9200;
keepalive 15;
}
upstream kibana_upstream {
server 127.0.0.1:5601;
}
# Kibana, public access, RO operations
@hkulekci
hkulekci / elastic_bulk-import-settings.sh
Created November 9, 2021 18:26 — forked from fitz123/elastic_bulk-import-settings.sh
Elastic | Performance tuning for big data import
##
# Temporary Speed-up configuration for fast import
# references: https://www.elastic.co/blog/performance-considerations-elasticsearch-indexing
# p.s. If you do not want to restart your node/cluster - don't perform 1 and 2 points
##
# 1. Change "ES_HEAP_SIZE" from 50% of memory (default and recommended) to something like 80%
mem=`free -m | grep Mem | awk '{ print $2 }'` && heap=$[ ($mem/1024)*80/100 ]g && \
sudo sed -i "s/ES_HEAP_SIZE=.*/ES_HEAP_SIZE=$heap/" /etc/init.d/elasticsearch
@hkulekci
hkulekci / search_as_you_type
Created March 15, 2021 21:57 — forked from xeraa/search_as_you_type
Elasticsearch's search_as_you_type and completion suggester fields in action
PUT jobs
{
"mappings": {
"properties": {
"title": {
"type": "search_as_you_type"
}
}
}
}
<?php
function get_tls_version($sslversion = null)
{
$c = curl_init();
curl_setopt($c, CURLOPT_URL, "https://www.howsmyssl.com/a/check");
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
if ($sslversion !== null) {
curl_setopt($c, CURLOPT_SSLVERSION, $sslversion);
}

Reading data before application startup in Angular 2

In this demonstration I will show you how to read data in Angular2 final release before application startup. You can use it to read configuration files like you do in other languages like Java, Python, Ruby, Php.

This is how the demonstration will load data:

a) It will read an env file named 'env.json'. This file indicates what is the current working environment. Options are: 'production' and 'development';

b) It will read a config JSON file based on what is found in env file. If env is "production", the file is 'config.production.json'. If env is "development", the file is 'config.development.json'.

<code_scheme name="PSR Erdem">
<PHPCodeStyleSettings>
<option name="ALIGN_KEY_VALUE_PAIRS" value="true" />
<option name="ALIGN_PHPDOC_PARAM_NAMES" value="true" />
<option name="ALIGN_PHPDOC_COMMENTS" value="true" />
<option name="COMMA_AFTER_LAST_ARRAY_ELEMENT" value="true" />
<option name="PHPDOC_BLANK_LINES_AROUND_PARAMETERS" value="true" />
<option name="PHPDOC_WRAP_LONG_LINES" value="true" />
<option name="LOWER_CASE_BOOLEAN_CONST" value="true" />
<option name="LOWER_CASE_NULL_CONST" value="true" />
@hkulekci
hkulekci / PHPUnit way to mock Doctrine2 Entity Manager.php
Last active August 26, 2015 03:48 — forked from wowo/PHPUnit way to mock Doctrine2 Entity Manager.php
PHPUnit's way to mock Doctrine2 Entity Manager
<?php
class AbstractManagerBase extends \PHPUnit_Framework_TestCase
{
protected function getEmMock()
{
$emMock = $this->getMock('\Doctrine\ORM\EntityManager',
array('getRepository', 'getClassMetadata', 'persist', 'flush'), array(), '', false);
$emMock->expects($this->any())
->method('getRepository')
<?php
// http://www.elasticsearch.com/docs/elasticsearch/rest_api/
class ElasticSearch {
public $index;
function __construct($server = 'http://127.0.0.1:9200'){
$this->server = $server;
}
@hkulekci
hkulekci / LICENSE.txt
Created May 2, 2012 21:16 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@hkulekci
hkulekci / yokVT.sql
Created April 26, 2012 06:13
üniversite - fakülte - bölüm
CREATE TABLE `yok_bolumler` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`fakulteId` varchar(40) NOT NULL,
`universiteId` int(6) NOT NULL,
`name` varchar(255) NOT NULL,
PRIMARY KEY (`id`),
KEY `fakulteHash` (`fakulteId`)
) ENGINE=MyISAM;
INSERT INTO `yok_bolumler` (`id`, `fakulteId`, `universiteId`, `name`) VALUES