Skip to content

Instantly share code, notes, and snippets.

View bpteam's full-sized avatar
:shipit:
ship it

Evgeny Pynykh bpteam

:shipit:
ship it
View GitHub Profile
@bpteam
bpteam / 01 Create a debug version of the docker image.sh
Last active May 15, 2020 19:50 — forked from sh41/01 Create a debug version of the docker image.sh
Debugging segmentation faults in PHP in a docker container.
git clone https://github.com/docker-library/php.git docker-library-php
## Go to the specific version you're interested in
cd docker-library-php/7.4/fpm/alpine
## Edit the .Dockerfile.
## Change
## ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data
## to
## ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --enable-debug
## Comment out or delete:
@bpteam
bpteam / Virtual Box Host Only Static IP.md
Created March 20, 2018 22:37 — forked from pjdietz/Virtual Box Host Only Static IP.md
VirtualBox Host-Only Adapter with Static IP

VirtualBox Host-Only Static IP

My typical setup for a development box in VirtualBox uses two NICs. The first uses NAT to allow the box to communicate with the outside world through my host computer’s network connection. (NAT is the default, so shouldn't require any setup.) The second is a "host-only" connection that allows my host and guest to interact.

To create a host-only connection in VirtualBox, start by opening the preferences in VirtualBox. Go to the "Network" tab, and addd a Host-only Network. Modify the host-only network, and disable DHCP. Make a note of the IP address. (Feel free to set the IP address as well, if you like.)

Next, assign this host-only adapter to the virtual machine. Select the VM and press "Settings". Go to the "Network" tab, and select "Adpater 2". Enable the adapter, set it to a "Host-only Adapter", and select the adpater you created above.

Temporary

inventory = Inventory()
gold = Gold()
gold.quantity = 15
inventory.put(gold)
bagpack = Bagpack(inventory)
hero = Hero(bagpack)
@bpteam
bpteam / selenium-screenshotting.md
Created March 28, 2016 19:46 — forked from dannguyen/selenium-screenshotting.md
Using Selenium and Python to screenshot a javascript-heavy page

Using Selenium and Python to screenshot a javascript-heavy page

As websites become more JavaScript heavy, it's harder to automate things like screenshotting for archival purposes. I've seen examples and suggestions to use PhantomJS for visual testing/archiving of websites, but have run into issues such as the non-rendering of webfonts. I've never tried out Selenium until today...and while I'm not thinking about performance implications yet, Selenium seems far more accurate than PhantomJS...which makes sense since it actually opens a real browser. And it's not too hard to script to do complex interactions: here's an [example of how to log in to Twitter, write a tweet, upload an image, and send a tweet via Selenium and DOM element selection](https://gist.github.com/dannguyen/8a6fa49253c1d6a0eb92

------
< moo >
------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
<?php
class A {
private function foo() {
echo "success!\n";
}
public function test() {
$this->foo();
static::foo();
}
}
<?php
require "vendor/autoload.php";
use bpteam\Parser\Phone\Phone;
$phone = new Phone('RU');
$text = 'Сдаются 1-,2- и 3-комнатные квартиры, на любой срок по часам .
Все удобства, кабельное ТВ, Wi-Fi, стиральная машина-автомат, посуда,
постельное бельё. Командированным скидки. Отчетные 8 905 111-22-33
документы предоставляем .';
@bpteam
bpteam / docker-compose.yml
Created November 8, 2015 13:45
My web dev docker-compose.yml
fpm:
image: php-fpm-dev #наш контейнер со всеми необходимыми расширениями
links:
- mysql
- memcached
volumes:
- ./:/var/www # подключаем проект к php-fpm
mysql:
image: mysql
volumes:
@bpteam
bpteam / Dockerfile
Last active November 8, 2015 15:51
My php-fpm-dev dockerfile
#Dir for extensions config /usr/local/etc/php/conf.d/
FROM php:5.6-fpm
RUN apt-get update
RUN apt-get install -y php5-dev php-pear php5-common
# curl уже входит в образ 5.6-fpm но на всякие пожарные попробуем установить
RUN apt-get install -y curl libcurl4-openssl-dev
RUN docker-php-ext-install curl
@bpteam
bpteam / not_gc.php
Created October 8, 2015 17:32
die without gc
<?php
var_dump(gc_enabled());
gc_disable();
var_dump(gc_enabled());
class Demo
{
function __construct()
{
echo "constructor\n";
}