Skip to content

Instantly share code, notes, and snippets.

View bcremer's full-sized avatar

Benjamin Cremer bcremer

View GitHub Profile
php -r 'echo implode("\n", get_defined_functions()["internal"]);' | awk '{ print length($0) " " $0; }' | sort -rn | head -10
38 xml_set_processing_instruction_handler
38 intltz_create_time_zone_id_enumeration
38 intlcal_set_minimal_days_in_first_week
38 intlcal_get_minimal_days_in_first_week
37 mcrypt_module_is_block_algorithm_mode
37 mcrypt_module_get_supported_key_sizes
37 intlcal_set_repeated_wall_time_option
37 intlcal_get_repeated_wall_time_option
37 intlcal_get_keyword_values_for_locale
@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