Skip to content

Instantly share code, notes, and snippets.

View mkorkmaz's full-sized avatar

Mehmet Korkmaz mkorkmaz

View GitHub Profile
@mkorkmaz
mkorkmaz / GarantiPOS.php
Last active May 16, 2019 14:46
Garanti Pay
<?php
declare(strict_types=1);
namespace MyApp\Helper;
use Psr\Log\LoggerInterface as Logger;
class GarantiPOS
{
private const GARANTI_PAY_TYPE = 'gpdatarequest';
@mkorkmaz
mkorkmaz / keybase_gpg_git_sign.sh
Last active February 10, 2019 16:28
Signing git commits using keybase gpg
# Asuming you have keybase installed and generated a gpg key
keybase pgp export # list your keybase gpg keys
# user: Mehmet Korkmaz <mehmet@mkorkmaz.com>
# 4096-bit RSA key, ID GPG_KEY, created 2019-01-01
keybase pgp export -q GPG_KEY | gpg --import
keybase pgp export -q GPG_KEY --secret --unencrypted| gpg --import --allow-secret-key-import
gpg --list-secret-keys --keyid-format LONG
# /Users/reformo/.gnupg/pubring.kbx
# ---------------------------------
# sec rsa4096/GPG_KEY 2019-01-06 [SC] [expires: 2035-01-02]
{
"telemetry.enableCrashReporter": false,
"cSpell.userWords": [
],
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.detectIndentation": false,
"editor.fontFamily": "Consolas, Menlo, Monaco, 'Courier New', monospace",
"editor.fontSize": 13,
"editor.minimap.enabled": false,
@mkorkmaz
mkorkmaz / captcha_solver.py
Created January 26, 2019 15:34
Solves simple captchas has only digits
import cv2
import pytesseract
from os import walk
pytesseract.pytesseract.tesseract_cmd = r'/usr/local/bin/tesseract'
config = u" -c tessedit_char_whitelist=0123456789 --oem 3 --psm 7 -l digits"
def solve(file):
image_file_name = './data/' + file
im = cv2.imread(image_file_name)
server {
listen 80;
listen [::]:80;
server_name cdn-images.example.com;
server_tokens off;
location / {
rewrite ^/(.*)/subfolder/(.*)$ /images/$1/anothersubfolder/anothersubfolder/$2;
proxy_pass https://my-bucketname.ams3.digitaloceanspaces.com/;
proxy_hide_header Strict-Transport-Security;
}
server {
listen 80;
listen [::]:80;
root /var/lib/www;
server_name _;
server_tokens off;
more_clear_headers Server;
add_header Server "selami/image-server";
@mkorkmaz
mkorkmaz / nginx_real_time_image_resizing_and_caching.conf
Last active October 31, 2018 13:54
Nginx: Real time image resizing and caching
# Copied from https://github.com/sergejmueller/sergejmueller.github.io/wiki/Nginx%3A-Real-time-image-resizing-and-caching
#
# Requirements
# ngx_http_image_filter_module
#
# Usage
# http://localhost/imagine/picture.jpg?w=1024&q=75
# http://localhost/imagine/picture.jpg?h=500&q=30
#
# Parameter Description
@mkorkmaz
mkorkmaz / update-dev-env.sh
Created October 9, 2018 20:48
Gets postgresql dump file from the server, restores local database and executes a sql file (i.e a script to reset user passwords for testing purposes)
#
# cron job runs at my-db-server with this configuration
# @daily pg_dump -Fc myRemoteDatabase > /var/lib/postgresql/backups/my-remote-database.dump
#
scp user@ssh.my-db-server.com:/var/lib/postgresql/backups/my-remote-database.dump ./temp.dump
pg_restore -h 127.0.0.1 -p 5432 -U postgres -c -d myLocalDatabase < ./temp.dump
psql -h 127.0.0.1 -p 5432 -U postgres -d myLocalDatabase -a -f ./reset-passwords.sql
@mkorkmaz
mkorkmaz / bitbucket-pipelines.yml
Last active June 18, 2018 01:24
Bitbucket pipeline example for PHP 7.1 + MongoDB + Memcached + Codeception
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: php:7.1
pipelines:
default:
- step:
caches:
- composer
script:
@mkorkmaz
mkorkmaz / .htaccess
Created May 23, 2017 09:45
Apache redirect according to date.
RewriteCond %{TIME_YEAR}%{TIME_MON}%{TIME_DAY} > 20170523
RewriteRule ^$ /destination/url.html [R=301,L]