Skip to content

Instantly share code, notes, and snippets.

<?php
echo "----------------------------------\n";
echo "| PHP to Swig Template Converter |\n";
echo "| |\n";
echo "| @yasinaydin @edigu |\n";
echo "----------------------------------\n";
// User settings
@ilhnctn
ilhnctn / Çalışma Ortamı.md
Last active January 25, 2018 13:50
Installing Ubuntu

Terminal/Emilator Kurulumu

Mac-iTerm'e alışıksanız Terminator daha uyumludur.

sudo apt-get install guake

# Oh-my-god :)
apt-get install zsh
apt-get install git-core # if not installed
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
@ilhnctn
ilhnctn / os-x-for-php.sh
Last active April 3, 2017 13:12
OS X installition for PHP-Postresql-AMQP-Elasticsearch Development
#Install brew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
# Change default shell to zsh :)
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# To Install PHP 5.6
#Setup the homebrew/dupes tap which has dependencies we need:
@ilhnctn
ilhnctn / eval_docker_machine.sh
Created February 8, 2018 08:20
Connect to docer-machine environment from terminal
eval_docker_machine(){
MACHINE_NAME = $1
if [[ $# -eq 0 ]] ; then
echo "\033[41;37;1m Usage: edm name_of_machine_env !!! \033[0m"
exit(1)
fi
echo "\033[41;37;1m Eval to Docker-machime for $MACHINE_NAME !!! \033[0m"
docker-machine ls -t 30
docker-machine env $MACHINE_NAME
@ilhnctn
ilhnctn / gunicorn.conf
Created February 13, 2018 12:48
supervisord + gunicorn + nginx
[program:gunicorn]
command=/bin/gunicorn -w 4 myapp:app
environment=MY_ENV=/var/null
user=www-data

Docker

Agenda

  • What is docker?
  • Docker vocabulary & commands
  • Compose & usage
  • Demo (dockerise Omnishop)
  • Docker for Dev & CI/CD (next session ?)
  • Kubernetes/AWS (next session)
@ilhnctn
ilhnctn / merge_master_to_current_branch.sh
Created December 13, 2018 14:03
fetches master and merge into the branch passed as parameter
master_merge(){
TARGET_BRANCH = $1
if [[ $# -eq 0 ]] ; then
echo "\033[41;37;1m Usage: mm name_of_branch !!! \033[0m"
exit(1)
fi
echo "\033[41;37;1m Fetch/pull master and merge into $TARGET_BRANCH !!! \033[0m"
git checkout master
git pull
@ilhnctn
ilhnctn / kube-tutorial.md
Last active November 12, 2020 09:52
A basic outline of kubernetes installation on local
@ilhnctn
ilhnctn / postgresql-performance-tuning.md
Created December 6, 2020 12:20
Text content of Stefan Frost's Postgresql Performance Talk

Identify Slow Queries

See talk

  • use application_name in qs (if more than one app connects to db)
  • Native Partitioning is better than pg_partman

Logging

=> The more you log, the better you locate performance battlenecks. Also the mor you log, the more you slow down your system.
=> pgbadger, pg_stat_statements (what is currently happening)
@ilhnctn
ilhnctn / queries.md
Last active August 3, 2022 16:23
Useful Query & Commands For DB Maintenance/Monitoring

This document tries to combine basic/general query and commands that can be useful for database maintenance and monitoring.

Get Info About Current Active Connections

Here you can list active/iddle connections to the database and see the actual queries that hit the DB.

Note: If there are too much concurrent requests to your database server (not to a single DB instance), than you should consider reducing iddle connections. Especially if there are too much old iddle connections.

SELECT * FROM pg_stat_activity;