Skip to content

Instantly share code, notes, and snippets.

View boesing's full-sized avatar
🐢

Maximilian Bösing boesing

🐢
  • Cologne
  • 18:46 (UTC +02:00)
View GitHub Profile
@boesing
boesing / php-binary.sh
Last active August 19, 2021 13:56
PHP binary by composer.json
#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
REALPATH_PHP_BINARY="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$REALPATH_PHP_BINARY/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
@boesing
boesing / timescaledb.md
Created November 17, 2020 10:44
Home Assistant SQLite to TimescaleDB

Migration from SQLite to Timescale DB

  1. Prepare local environment
    1. Install pgcli and pgloader
  2. Prepare homeassistant environment
    1. Install timescaledb addon (supervisor required)
    2. Configure addon (you have to manually add the listening port in the addons configuration page)
  3. Stop homeassistant core with ha core stop (when connected via SSH to your homeassistant instance)
  4. Fetch home-assistant_v2.db via SCP to your local machine (which you've prepared in step #1)
  5. Execute pgloader to migrate SQLite DB to PostgresSQL
@boesing
boesing / realuser.vim
Last active May 27, 2017 11:04
Detect the real user if you changed to root by e.g. using sudo or su and include the users .vimrc so you have your user configuration while using vim as root
" Name: realuser.vim
" Version: 1.0
" Author: Max Boesing <max@kriegt.es>
" Summary: Vim plugin to load users own .vimrc if existent and if the current
" user is root
if ! exists("g:realuser")
let g:realuser=system('w | grep $(ps w | grep ' . getpid() . ' | head -n1 | awk "{ print \$2 }") | awk "{ print \$1 }"')
if $USER == 'root'
let g:vimrc=system('printf /home/%s/.vimrc '. g:realuser)
if filereadable(g:vimrc)
@boesing
boesing / private.xml
Created August 6, 2016 12:11
[Karabiner] FN to CTRL-L
<?xml version="1.0"?>
<root>
<devicevendordef>
<vendorname>Apple_Internal_Keyboard_Vendor</vendorname>
<vendorid>0x05ac</vendorid>
</devicevendordef>
<deviceproductdef>
<productname>Apple_Internal_Keyboard_Product</productname>
<productid>0x0273</productid>
@boesing
boesing / oxid
Last active August 29, 2015 14:09
NGINX OXID configuration
server {
listen 80;
listen [::]:80;
root /var/www/oxid;
index index.php index.html;
server_name oxid.tld;