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 / cube.c
Created April 4, 2012 10:41
OpenGL Cube Example
#include<stdio.h>
#include <gl/glut.h>
#define KEY_ESC 27 /* GLUT doesn't supply this */
int fullscreen = 0;
int mouseDown = 0;
float xrot = 100.0f;
float yrot = -100.0f;
@hkulekci
hkulekci / QdrantServiceProvider.php
Created February 24, 2024 05:14
Qdrant Laravel
<?php
/**
* @since Apr 2023
* @author Haydar KULEKCI <haydarkulekci@gmail.com>
*/
namespace App\Providers;
use Illuminate\Contracts\Support\DeferrableProvider;
use Illuminate\Support\ServiceProvider;
@hkulekci
hkulekci / detect.js
Created August 23, 2012 07:31
Detect Operating System with Javascript
// This script sets OSName variable as follows:
// "Windows" for all versions of Windows
// "MacOS" for all versions of Macintosh OS
// "Linux" for all versions of Linux
// "UNIX" for all other UNIX flavors
// "Unknown OS" indicates failure to detect the OS
var OSName="Unknown OS";
if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
@hkulekci
hkulekci / 01 - Readme.md
Last active December 28, 2023 19:35
Download Folder Recursively for Box Cloud

Usage

Create an app through developer platform :

https://<your-account>.app.box.com/developers/console

Then later, get the service account email from the general settings :

@hkulekci
hkulekci / solve.md
Last active October 5, 2023 20:08
Elasticsearch "blocked by: [FORBIDDEN/12/index read-only / allow delete (api)" error

If u are getting below error while indexing:

{
  "error": {
    "root_cause": [
      {
        "type": "cluster_block_exception",
        "reason": "blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];"
 }
@hkulekci
hkulekci / terms_set_query.md
Last active September 9, 2023 09:00
terms_set Query
DELETE job-candidates

PUT job-candidates
{
  "mappings": {
    "properties": {
      "name": {
        "type": "keyword"
      },
@hkulekci
hkulekci / percolator.md
Last active September 9, 2023 04:53
Percolator Field with Nested Query
PUT testindex1
{
  "mappings": {
    "properties": {
      "search": {
        "properties": {
          "query": { 
            "type": "percolator" 
          }
@hkulekci
hkulekci / sample.md
Created June 28, 2023 14:08
Some Sample Data
The clear, refreshing taste of tap water quenches my thirst on hot summer days.
Please make sure to filter the tap water before drinking it.
The tap in the kitchen was leaking, causing the water to drip incessantly.
After a long hike, we refilled our water bottles with tap water from the nearby fountain.
It's important to conserve tap water and use it wisely to protect our natural resources.
The tap water in this area has a slightly metallic taste, which can be off-putting to some people.
The plumber fixed the broken tap, ensuring a steady flow of water throughout the house.
My grandma always used to boil tap water before using it in cooking or drinking.
The city council implemented a new filtration system to improve the quality of tap water.
@hkulekci
hkulekci / size.md
Last active June 23, 2023 11:58
Elasticsearch Nested Array Object Size Aggregation
# images field type is nested
GET products/_search
{
  "track_total_hits": true, 
  "size": 0, 
  "aggs": {
    "counts": {
      "terms": {
 "script": "params['_source']['images'].size()",
@hkulekci
hkulekci / kinesis.py
Last active April 29, 2023 08:04
Kinesis Queue Check
import boto3
def check_kinesis_stream_data(stream_name):
# Create a Kinesis client using your AWS credentials
kinesis_client = boto3.client('kinesis')
# Get the shard iterator for the specified stream
shard_response = kinesis_client.describe_stream(StreamName=stream_name)
shard_id = shard_response['StreamDescription']['Shards'][0]['ShardId']
shard_iterator_response = kinesis_client.get_shard_iterator(