Skip to content

Instantly share code, notes, and snippets.

Piotr Plenik jupeter

Block or report user

Report or block jupeter

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@jupeter
jupeter / docker
Created Mar 24, 2017
Turn on Docker Remote API on Ubuntu (on port 2375)
View docker
# File: etc/default/docker
# Use DOCKER_OPTS to modify the daemon startup options.
#DOCKER_OPTS=""
DOCKER_OPTS="--dns 8.8.8.8 --dns 8.8.4.4 -H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock"
@jupeter
jupeter / phpbrew-install.sh
Last active Feb 21, 2019
PHPBrew for Symfony 3 on Ubuntu and Debian
View phpbrew-install.sh
# Install Requrements
apt-get install curl libxslt1-dev libreadline6-dev libmcrypt-dev libicu-dev g++ \
libcurl4-openssl-dev libssl-dev clibcurl4-openssl-dev pkg-config libssl-dev libsslcommon2-dev \
pkg-config libcurl3 autoconf libmagickwand-dev libmagickcore-dev
# Install PHPBrew (https://github.com/phpbrew/phpbrew)
curl -L -O https://github.com/phpbrew/phpbrew/raw/master/phpbrew; chmod +x phpbrew
sudo mv phpbrew /usr/local/bin/phpbrew
########################
@jupeter
jupeter / SampleControllerTest.php
Last active Jul 28, 2016
Sample test with login
View SampleControllerTest.php
<?php
/*
* This file is part of the MyJobCompany platform.
*
* © MyJobCompany https://myjob.company
*/
namespace tests\AppBundle\Controller;
@jupeter
jupeter / convert-to-flat-pdf.sh
Created May 23, 2016
Covert PDF to flat PDF
View convert-to-flat-pdf.sh
#!/bin/bash
FILE=$1
OUTPUTFILE=$2
TEMPDIR=`mktemp -d`
gs -q -dSAFER -dBATCH -dNOPAUSE -sDEVICE=jpeg -dJPEGQ=95 -r600 -o $TEMPDIR/out-%05d.jpg $FILE
SIZES=(`identify -format "%W-%H\n" $FILE`)
View isJpeg.function.php
function isJpeg($string) {
if(ord($string[0]) != 0xFF) {
return false;
}
if(ord($string[1]) != 0xD8) {
return false;
}
$count = strlen($string);
@jupeter
jupeter / flat-pdf.sh
Created Nov 25, 2013
Create flatten PDF file
View flat-pdf.sh
#!/bin/bash
# Script to convert PDF - create flatten PDF file
#
# Format:
# ./convert input-file.pdf output-file.pdf
@jupeter
jupeter / sfWidgetFormSelectRadioSingleable.class.php
Last active Dec 16, 2015
sfWidgetFormSelectRadioSingleable Symfony widget lets you render just one option at a time. Extends sfWidgetFormSelectRadio. Inspiration from https://gist.github.com/ain/4165050
View sfWidgetFormSelectRadioSingleable.class.php
<?php
/**
* This file is part of the MnumiPrint package.
*
* (c) Mnumi Sp. z o.o. <mnumi@mnumi.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
@jupeter
jupeter / ssh_key_validation.php
Created Aug 3, 2012
SSH-RSA/SSH-DSA validation
View ssh_key_validation.php
<?php
public function validateKey($value)
{
$key_parts = explode(' ', $value, 3);
if (count($key_parts) < 2) {
return false;
}
View gist:2643182
/*
* Formatter for Selenium 2 / WebDriver PHP client.
*/
var subScriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader);
subScriptLoader.loadSubScript('chrome://selenium-ide/content/formats/webdriver.js', this);
function useSeparateEqualsForArray() {
return true;
}
@jupeter
jupeter / New way to set the encoder.
Created Dec 31, 2011 — forked from damienalexandre/New way to set the encoder.
Playing with the Symfony2 serializer
View New way to set the encoder.
<?php
// Inside your action
$this->serializer = new \Symfony\Component\Serializer\Serializer();
$this->serializer->addNormalizer(new \Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer());
$this->serializer->setEncoder('xml', new \Symfony\Component\Serializer\Encoder\XmlEncoder());
return $this->createResponse($this->serializer->encode($page, 'xml'), 200, array('Content-Type' => 'application/xml'));
You can’t perform that action at this time.