Skip to content

Instantly share code, notes, and snippets.

View bcremer's full-sized avatar

Benjamin Cremer bcremer

View GitHub Profile
@bcremer
bcremer / README.md
Last active May 23, 2016 10:43
Let's Encrypt and Nginx

Let's Encrypt

Using the Let's Encrypt (certbot)[https://certbot.eff.org/] with the webroot plugin in nginx.

Installation

Install certbot on a regular user-account:

wget https://dl.eff.org/certbot-auto
@bcremer
bcremer / unused_constructor_dependency.php
Last active April 7, 2016 06:55
PhpStorm find unused constructor dependency
<?php
class MyService
{
private $debA;
// $debB is not used but in the constructor
// I would like a phpstorm inspection to find that
private $debB;
public function __construct($debA, $debB)

i3 configuration

My configuration file for the i3 window manager.

Window movement

Instead of the arrow keys or the i3 default keys j k l + this configuration uses VIM style keys (h, j, k, l) for window movement.

Example

WIN + {h, j, k, l} = Move focus {left, down, up, right}

Verifying that +bcremer is my blockchain ID. https://onename.com/bcremer
class LazyString
{
/**
* @var callable
*/
private $callee;
/**
* @param callable $callee
*/
@bcremer
bcremer / tty-username.md
Last active August 29, 2015 14:25
Half-autologin to virtual console (prompt for password)

Skip question for username during tty login

Found on reddit.

$ sudo systemctl edit getty@tty1
[Service]
@bcremer
bcremer / shopware_standalone.php
Created July 7, 2015 07:54
Shopware Standalone
<?php
require $PATH_TO_SHOPWARE . '/autoload.php';
$environment = getenv('SHOPWARE_ENV') ?: getenv('REDIRECT_SHOPWARE_ENV') ?: 'production';
$kernel = new Shopware\Kernel($environment, $environment !== 'production');
$kernel->boot();
$container = $kernel->getContainer();
@bcremer
bcremer / perf.log
Last active August 29, 2015 14:23
PHP 7 Performance
vagrant@php7dev:/var/www/shopware$ php -v && time ./bin/console sw:theme:cache:generate
PHP 5.6.8-dev (cli) (built: Mar 29 2015 04:48:54)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies
Generating theme cache for shop "Deutsch" ...
Clearing HTTP cache ...
real 0m4.766s
user 0m4.660s
@bcremer
bcremer / selpass.sh
Created April 16, 2015 19:39
Lasspas CLI Fuzzy Select
#!/bin/bash
## Interactive password selection using lastpass-cli and selecta
## the password is written in to the primary clipboard
## https://github.com/lastpass/lastpass-cli
## https://github.com/garybernhardt/selecta
lpass ls | selecta | grep -Po '(?<=(\[id: ))[0-9]*?(?=\])' | xargs lpass show -c --password
@bcremer
bcremer / build-minimal-php.sh
Last active May 11, 2023 14:39
Compile Minimal Version of PHP used for Lint-Check legacy code
mkdir source
cd source
wget http://museum.php.net/php5/php-5.2.17.tar.gz
tar xvf php-5.2.17.tar.gz
cd php-5.2.17
./configure --disable-all --enable-static --enable-cli
make
cp sapi/cli/php ~/bin/php5.2.17-x64-static