Skip to content

Instantly share code, notes, and snippets.

Avatar
🔥
Fixing bugs

Ruud Kamphuis ruudk

🔥
Fixing bugs
View GitHub Profile
@ruudk
ruudk / battery.60m.sh
Created Jun 7, 2019
Bitbar Mouse Battery Notifier
View battery.60m.sh
#!/bin/bash
BATT=$(ioreg -c AppleDeviceManagementHIDEventService -r -l | grep -i mouse -A 20 | grep BatteryPercent | cut -d= -f2 | cut -d' ' -f2)
# defaults to warn at 20%; accepts other number as 1st argument (useful for testing)
COMPARE=${1:-20}
if [ -z "$BATT" ]; then
echo 'No mouse found.'
exit 0
@ruudk
ruudk / gist:fba6826ed44b65f6bd0c6bcc3417b112
Created Dec 27, 2018
php_2018-12-27-193829_RuudBook-Pro.crash
View gist:fba6826ed44b65f6bd0c6bcc3417b112
Process: php [37957]
Path: /usr/local/Cellar/php/7.3.0/bin/php
Identifier: php
Version: 0
Code Type: X86-64 (Native)
Parent Process: php [37956]
Responsible: php [37957]
User ID: 501
Date/Time: 2018-12-27 19:38:28.953 +0100
@ruudk
ruudk / # php - 2018-04-12_16-40-02.txt
Created Dec 27, 2018
php on macOS 10.14.2 - Homebrew build logs
View # php - 2018-04-12_16-40-02.txt
Homebrew build logs for php on macOS 10.14.2
Build date: 2018-04-12 16:40:02
View keybase.md

Keybase proof

I hereby claim:

  • I am ruudk on github.
  • I am ruudk (https://keybase.io/ruudk) on keybase.
  • I have a public key ASCVbtM2zKFqoGYjMddeyhtPSDsT--_oCjJr3n2g_xa5Ogo

To claim this, I am signing this object:

@ruudk
ruudk / ReplaceSimpleBusMiddleware.php
Created Jul 3, 2015
Replace a SimpleBus middleware
View ReplaceSimpleBusMiddleware.php
<?php
namespace TicketSwap\Core\CoreBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
class ReplaceSimpleBusMiddleware implements CompilerPassInterface
{
@ruudk
ruudk / worker_bootstrap.php
Created Nov 14, 2014
Custom bootstrap for BCCResqueBundle
View worker_bootstrap.php
<?php
/**
* Bootstrap file used by PHP Resque/Supervisor
*/
if (extension_loaded('newrelic')) {
newrelic_background_job(true);
newrelic_set_appname('Worker');
}
require_once __DIR__ . '/bootstrap.php.cache';
@ruudk
ruudk / retry.php
Created Nov 28, 2013
Exponential retry backoff strategy for PHP Resque
View retry.php
<?php
Resque_Event::listen('onFailure', function(Exception $exception, Resque_Job $job) {
$args = $job->getArguments();
if(!isset($args['retryAttempt'])) {
$args['retryAttempt'] = 0;
}
$exponentialBackoffStrategy = array(0, 10, 60, 300, 900, 3600, 7200);
if(!isset($exponentialBackoffStrategy[$args['retryAttempt']])) {
@ruudk
ruudk / proxy.sh
Created Nov 15, 2013
Proxy all HTTP traffic to other server
View proxy.sh
#!/bin/sh
if [ -z "$1" ]; then
echo "Please give me the account to start the proxy for. ";
exit 0
fi
account=$1
target="178.251.24.124"
@ruudk
ruudk / route_email.sh
Created Nov 15, 2013
Route all e-mail to other server
View route_email.sh
#!/bin/sh
if [ -z "$1" ]; then
echo "Please give me the account to change the routes for. ";
exit 0
fi
account=$1
target="server3.1plus1media.nl."
You can’t perform that action at this time.