Skip to content

Instantly share code, notes, and snippets.

@bskiefer
bskiefer / blackfire.sh
Last active March 4, 2020 09:26
PHPBrew Blackfire Extension Installer
#!/usr/bin/env bash
# Automatically finds your php version, installs, and enables the blackfire extension on your current php.
source ~/.phpbrew/bashrc
EXTENSION_URL="https://packages.blackfire.io/binaries/blackfire-php/1.27.0/blackfire-php-linux_amd64-php-VERSION.so"
PHP_VERSION=$(php -r 'echo PHP_MAJOR_VERSION . PHP_MINOR_VERSION;')
EXT_DIR=$(phpbrew path ext)
@bskiefer
bskiefer / bluetooth.sh
Last active May 27, 2019 02:23
Connect rpi bluetooth devices automatically
#!/bin/bash
BLUETOOTH_DIR=/var/lib/bluetooth
for CONTROLLER_DIR in ${BLUETOOTH_DIR}/*; do
CONTROLLER_MAC=$(basename ${CONTROLLER_DIR})
if [ -d "${CONTROLLER_DIR}" ] && [[ $CONTROLLER_MAC =~ ^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$ ]] ; then
for DEVICE_DIR in ${CONTROLLER_DIR}/*; do
DEVICE_MAC=$(basename ${DEVICE_DIR})
if [ -d "${DEVICE_DIR}" ] && [[ $DEVICE_MAC =~ ^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$ ]] ; then
@bskiefer
bskiefer / .php
Created January 24, 2014 16:05 — forked from myselfsufiyan/.php
<?php
// place this code inside a php file and call it f.e. "download.php"
$path = $_SERVER['DOCUMENT_ROOT']."/path2file/"; // change the path to fit your websites document structure
$fullPath = $path.$_GET['download_file'];
if ($fd = fopen ($fullPath, "r")) {
$fsize = filesize($fullPath);
$path_parts = pathinfo($fullPath);
$ext = strtolower($path_parts["extension"]);