Skip to content

Instantly share code, notes, and snippets.

View mikoj's full-sized avatar
🏠
Working from home

Grzegorz Synowiec mikoj

🏠
Working from home
View GitHub Profile
@mikoj
mikoj / php7.x
Last active August 1, 2018 17:58
FROM php:fpm
# install the PHP extensions we need
RUN apt-get update && apt-get install -y libfreetype6-dev libpng-dev libjpeg62-turbo-dev libmemcached-dev zlib1g-dev && rm -rf /var/lib/apt/lists/* \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-png-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install -j$(nproc) gd mysqli opcache pdo_mysql \
&& pecl install memcached-3.0.4 \
&& docker-php-ext-enable memcached
# set recommended PHP.ini settings
@mikoj
mikoj / wordpress_varnish.vcl
Last active September 3, 2017 09:04
wordpress varnish vcl varnish version 5.1 vcl 4.0
#
# This is an example VCL file for Varnish.
#
# It does not do anything by default, delegating control to the
# builtin VCL. The builtin VCL is called when there is no explicit
# return statement.
#
# See the VCL chapters in the Users Guide at https://www.varnish-cache.org/docs/
# and https://www.varnish-cache.org/trac/wiki/VCLExamples for more examples.
@mikoj
mikoj / Singleton.php
Last active May 12, 2022 14:33
php7 Singleton final private __construct
<?php
interface ISingleton {
public static function getInstance(): ISingleton;
}
abstract class Singleton implements ISingleton {
private static $_instances = [];
final private function __construct () {}
@mikoj
mikoj / ban.rb
Last active August 29, 2015 14:16
Displayed command to ban ip
require 'open3'
stdin, stdout, stderr = Open3.popen3('iptables -L -n')
bannedIp = []
stdout.readlines.each {|ip|
m = ip.match /DROP\x20+all\x20+--\x20+(([0-9]{1,3}\.){3}[0-9]{1,3})\x20+(([0-9]{1,3}\.){3}[0-9]{1,3})\/([0-9]+)/
unless m == nil then
bannedIp << m[1]
end
}