Skip to content

Instantly share code, notes, and snippets.

View turgayozgur's full-sized avatar
👾
Focusing

Turgay turgayozgur

👾
Focusing
View GitHub Profile
@turgayozgur
turgayozgur / magneto2geoipindex.php
Last active November 20, 2016 00:00
Magento2 index.php with GeoIP2
<?php
/**
* Application entry point
*
* Example - run a particular store or website:
* --------------------------------------------
* require __DIR__ . '/app/bootstrap.php';
* $params = $_SERVER;
* $params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE] = 'website2';
* $params[\Magento\Store\Model\StoreManager::PARAM_RUN_TYPE] = 'website';
@turgayozgur
turgayozgur / whereequal.cs
Last active May 3, 2017 10:42
C# Generate Expression to Select with Where
private IQueryable<T> WhereEqual<T>(IQueryable query, string prop, object param)
{
var select = Expression.Parameter(typeof(T), "select");
MemberExpression property = null;
foreach (var node in prop.Split('.'))
{
property = property == null
? Expression.Property(select, node)
: Expression.Property(property, node);
@turgayozgur
turgayozgur / qor-auth-password-handlers.go
Last active September 12, 2019 12:02
/go/src/github.com/qor/auth/providers/password/handlers.go
package password
import (
"reflect"
"strings"
"github.com/qor/auth"
"github.com/qor/auth/auth_identity"
"github.com/qor/auth/claims"
"github.com/qor/qor/utils"
@turgayozgur
turgayozgur / nginx-lua-remove-non-ascii-from-cookie.conf
Last active November 26, 2018 11:44
Removing non ascii characters from request cookies for nginx
@turgayozgur
turgayozgur / aspnetcore-linux-deployment.sh
Last active March 6, 2023 13:38
ASPNET Core Zero Downtime Deployment to Linux with Nginx
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
# How to use?
# https://medium.com/@ozgurtrgy/aspnet-core-zero-downtime-deployment-to-linux-with-nginx-b8b230bf1577
# the variables depend on you.
PACKAGE_TAR_NAME="artifacts.tar.gz"
VERSION="1005"
@turgayozgur
turgayozgur / .circleci-dotnet-with-cache.yml
Created January 19, 2019 22:09
Building .NET Core App on circleci with caching packages. Restore only if required.
#
# The fallowing circleci config yml and bash scripts demonstrate
# how to build .NET Core app without restoring packages for every build
# until you referance smothing diffrent to any project inside sln.
#
# If you are building docker container when building your application,
# use the docker layer caching insted of these scripts. https://circleci.com/docs/2.0/docker-layer-caching/
#
version: 2
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
@turgayozgur
turgayozgur / custom-header-logger.go
Last active August 14, 2019 12:25
Golang custom logger that provides the request headers to log result.
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"runtime"
"time"
@turgayozgur
turgayozgur / cds.yaml
Last active November 27, 2019 18:59
Envoy Proxy Dynamic Configurations
# Here is the cluster definition. You can declare more than one cluster on there.
# Cluster definitions points to endpoint definitions(eds.yaml).
# Also, at this level you can configure a circuit breaker for the cluster.
version_info: "0"
resources:
- '@type': type.googleapis.com/envoy.api.v2.Cluster
name: "EnvoyNetCore"
connect_timeout: 5s
lb_policy: ROUND_ROBIN
node:
id: id_1
cluster: main
admin:
access_log_path: /tmp/envoy_admin_access.log
address:
socket_address:
address: 0.0.0.0
port_value: "9901"
dynamic_resources: