Skip to content

Instantly share code, notes, and snippets.

View MEGApixel23's full-sized avatar
🌴

Igor Omelchenko MEGApixel23

🌴
View GitHub Profile
@MEGApixel23
MEGApixel23 / git-rename-branch
Last active August 23, 2018 10:06 — forked from lttlrck/gist:9628955
Rename git branch locally and remotely
#!/bin/bash
if [ -z "$1" ]
then
echo "Specify old branch"
fi
if [ -z "$2" ]
then
echo "Specify new branch"
@MEGApixel23
MEGApixel23 / Install Upwork TeamApp on Ubuntu
Created May 13, 2016 07:51
Install Upwork TeamApp on Ubuntu
1. Download TeamApp from Upwork site.
2. Download one of the folowing libraries
32bit: https://launchpad.net/ubuntu/+archive/primary/+files/libgcrypt11_1.5.3-2ubuntu4.2_i386.deb
64bit: https://launchpad.net/ubuntu/+archive/primary/+files/libgcrypt11_1.5.3-2ubuntu4.2_amd64.deb
3. > sudo dpkg -i libgcrypt11_1.5.3-2ubuntu4.2_i386.deb
4. > sudo dpgk -i upwork_amd64.deb
dd if=/dev/zero of=/swapfile bs=1024 count=1024288
chown root:root /swapfile
mkswap /swapfile
swapon /swapfile
@MEGApixel23
MEGApixel23 / nginx.conf
Created July 1, 2016 09:03
nginx HTTPS config
server {
listen 80;
listen 443 ssl;
ssl on;
ssl_certificate /etc/nginx/ssl/adhoz_com.crt;
ssl_certificate_key /etc/nginx/ssl/adhoz.com;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:D$
ssl_session_cache shared:SSL:10m;
ssl_prefer_server_ciphers on;
@MEGApixel23
MEGApixel23 / php.ini
Created July 1, 2016 09:07
Enabling xdebug for PHP
# Add for xdebug into php.ini
zend_extension="/usr/lib/php5/20131226/xdebug.so"
xdebug.auto_trace = 0
xdebug.default_enable = 1
xdebug.max_nesting_level = 250
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_port = 9000
@MEGApixel23
MEGApixel23 / index.php
Created July 1, 2016 09:08
Direct image reading on PHP
<?php
// сбрасываем буфер вывода PHP, чтобы избежать переполнения памяти выделенной под скрипт
// если этого не сделать файл будет читаться в память полностью!
if (ob_get_level())
ob_end_clean();
header('Content-Type: image/jpeg');
// читаем файл и отправляем его пользователю
@MEGApixel23
MEGApixel23 / GeoIp.php
Created July 1, 2016 09:11
Simple class for GEO locating by IP. Uses http://geoip.elib.ru service
<?php
class GeoIp
{
private $basicUrl = 'http://geoip.elib.ru/cgi-bin/getdata_mini.pl';
public function __construct(array $options = null)
{
if (!$options)
return;
@MEGApixel23
MEGApixel23 / Remove From Git By Extension
Created October 11, 2016 08:30 — forked from benzittlau/Remove From Git By Extension
Remove all *.swp files from a git repository
git ls-files | grep '\.swp$' | xargs git rm
@MEGApixel23
MEGApixel23 / README.md
Created October 25, 2016 09:53 — forked from chadrien/README.md
Debug PHP in Docker with PHPStorm and Xdebug

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
&amp;&amp; echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" &gt; /usr/local/etc/php/conf.d/xdebug.ini \
docker exec -i segmentaiunstable_database_1 mysqldump -uroot -psecret segment_ai_unstable > /tmp/unst.sql
docker exec -i segmentai_database_1 mysql -uroot -psecret segment_ai < temp/ddd.sql