Skip to content

Instantly share code, notes, and snippets.

View cengizhancaliskan's full-sized avatar
:bowtie:

Cengizhan Çalışkan cengizhancaliskan

:bowtie:
View GitHub Profile
@cengizhancaliskan
cengizhancaliskan / default.vcl
Created June 8, 2018 07:37
varnish 4 config for symfony 3.x
vcl 4.0;
# Based on: https://github.com/mattiasgeniar/varnish-4.0-configuration-templates/blob/master/default.vcl
import std;
import directors;
backend server1 { # Define one backend
.host = "127.0.0.1"; # IP or Hostname of backend
.port = "80"; # Port Apache or whatever is listening
.max_connections = 300; # That's it
@cengizhancaliskan
cengizhancaliskan / most-useful-postgresql-command.csv
Last active April 22, 2022 15:05
Sık kullanılan postgresql komutları
Komut Açıklama
\q Çıkış yapmanızı sağlar.
\x Çıktıları genişletir.
\H Çıktıları html olarak verir.
\a Çıktıları hizalar.
\s Komut geçmişinizi listeler.
\g Bir önceki komutunuzu çalıştırır.
\c yada \connect [ VERITABANI_ADI [ KULLANICI_ADI ] [ HOST ] [ PORT ] ] Başka bir veritabanına bağlanmak için kullanılır.
\l Veritabanlarını listeler.
\l+ Veritabanlarını detaylı listeler. (veritabanı boyutunu da verir)
@cengizhancaliskan
cengizhancaliskan / locustfile.py
Created November 4, 2018 13:58
Locust example
# -*- coding: utf-8 -*-
from locust import HttpLocust, TaskSet, task
class FirstTestClass(TaskSet):
# @task attribute' methodumuzun task olduğunu belirtmek için kullanıyoruz.
@task
def index(self):
self.client.get("/locustio/locust")
@cengizhancaliskan
cengizhancaliskan / has_cyrillic.py
Last active November 13, 2019 05:55
Python has cyrillic, has chinese, get non chinese/cyrillic
# Reference: https://unicode-table.com/en/blocks/
# https://docs.oracle.com/cd/E29584_01/webhelp/mdex_basicDev/src/rbdv_chars_mapping.html
import re
def has_cyrillic(word):
# https://unicode-table.com/en/blocks/cyrillic/
# Languages: russian, ukrainian, bulgarian
return bool(re.search('[\u0400-\u04ff]', word))
@cengizhancaliskan
cengizhancaliskan / dynamically_call.py
Created November 18, 2019 13:42
Python call functions dynamically with getattr
class Cleaner(object):
def clean_name(self):
pass
cleaner = Cleaner()
for method_name in methods:
getattr(cleaner, method_name)()
### More Objective way
@cengizhancaliskan
cengizhancaliskan / pandas highlight row.py
Created November 21, 2019 13:38
Pandas highlight row
def highlight(row):
if row > 60:
return 'background-color: green'
else:
return 'background-color: none;'
df = df.style.applymap(highlight, subset=['Term', 'Count'])
@cengizhancaliskan
cengizhancaliskan / pandas read csv.py
Created November 21, 2019 13:51
Pandas read csv by with chunk for big size CSV files
filename = 'filename.csv'
chunksize = 10 ** 6
chunk_list = []
for chunk in pd.read_csv(filename, chunksize=chunksize, error_bad_lines=False):
chunk_list.append(chunk)
df = pd.concat(chunk_list)
@cengizhancaliskan
cengizhancaliskan / Dockerfile
Created March 19, 2020 19:43
jdk gradle dockerfile
FROM openjdk:8-jdk-alpine
##ENV GRADLE_VERSION 6.2.2
##ENV GRADLE_HOME /opt/gradle
##ENV PATH ${PATH}:${GRADLE_HOME}/bin
RUN apk update \
&& apk add --no-cache curl bash
# Install gradle
@cengizhancaliskan
cengizhancaliskan / .zshrc
Last active April 7, 2020 21:56
zsh config
export ZSH="/Users/$USER/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="random"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
@cengizhancaliskan
cengizhancaliskan / gist:d51edeb6bc929a5a706b2270797efe70
Created June 26, 2020 20:40
pyenv tkinter problem solve on macos
```bash
$ brew install tcl-tk
$ pyenv uninstall {used_version}
$ env \
PATH="$(brew --prefix tcl-tk)/bin:$PATH" \
LDFLAGS="-L$(brew --prefix tcl-tk)/lib" \
CPPFLAGS="-I$(brew --prefix tcl-tk)/include" \
PKG_CONFIG_PATH="$(brew --prefix tcl-tk)/lib/pkgconfig" \
CFLAGS="-I$(brew --prefix tcl-tk)/include" \