Skip to content

Instantly share code, notes, and snippets.

View bcremer's full-sized avatar

Benjamin Cremer bcremer

View GitHub Profile
@bcremer
bcremer / dropbox-share.sh
Last active August 29, 2015 13:56
Dropbox share file script
#!/usr/bin/env bash
##
# Required
# - dropbox-cli
# optional
# - xclip
# - convert (imagemagick)
##
@bcremer
bcremer / .vimrc
Created June 3, 2014 17:27
My .vimrc
set nocompatible " Disable vi compability
filetype off " required!
" Init Vundle
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
@bcremer
bcremer / .Xmodmap
Last active August 29, 2015 14:04
.Xmodmap to map Capslock + j/k to brace left / brace right
! Forget any previous Caps Lock
clear Lock
keycode 66 = ISO_Group_Shift ISO_Group_Shift ISO_First_Group NoSymbol
keycode 44 = j J braceleft Down dead_belowdot dead_abovedot dead_belowdot
keycode 45 = k K braceright Up kra ampersand kra
keycode 30 = u U bracketleft U downarrow uparrow downarrow
keycode 31 = i I bracketright I rightarrow idotless rightarrow
@bcremer
bcremer / gist:9df5add4ddad08b4bf04
Created August 7, 2014 19:13
PhpStorm use XDG Base Directories
mv ~/.WebIde70/config ~/.config/WebIde70
cp /usr/share/phpstorm/bin/idea.properties ~/.config/WebIde70/idea.properties
vim ~/.config/WebIde70/idea.properties~/.config/WebIde70/idea.properties
- # idea.config.path=${user.home}/.WebIde/config
+ idea.config.path=${user.home}/.config/WebIde70
- # idea.system.path=${user.home}/.WebIde/system
+ idea.system.path=${user.home}/.cache/WebIde70
@bcremer
bcremer / php_class_visibility
Last active August 29, 2015 14:06
PHP Class Visibility
$ php php_class_visibility.php
private method called.
private method called.
@bcremer
bcremer / null_coalesce_operator_example.php
Last active August 29, 2015 14:07
PHP Null Coalesce Operator. Available since PHP7, see: https://wiki.php.net/rfc/isset_ternary
<?php
error_reporting(-1);
ini_set('display_errors', 1);
$example = ['foo' => ['bar' => 'baz']];
var_dump(
$example['foo'] ?? []
);
@bcremer
bcremer / digitalocean_debian_jessie_systemd_howto.md
Created February 6, 2015 21:20
DigitalOcean Debian Jessie with systemd

Install Debian Jessie on DigitalOcean using the Debian 7.0 x64 Image.

First update to Debian 8.0 Jessie:

# Source:
# http://unix.stackexchange.com/questions/90389/how-to-upgrade-debian-stable-wheezy-to-testing-jessie/90391#90391
cp /etc/apt/sources.list{,.bak}
sed -i -e 's/ \(stable\|wheezy\)/ testing/ig' /etc/apt/sources.list
apt-get update
@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 / 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 / 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]