Skip to content

Instantly share code, notes, and snippets.

@dmdeller
dmdeller / volume-down.scpt
Created August 20, 2011 17:40
PowerMate volume scripts
set myVolume to output volume of (get volume settings)
set myVolume to (myVolume - 2)
set volume output volume myVolume
tell application "PowerMate"
set aDevice to first device
tell aDevice
make light state with properties {state type:steady, brightness:(myVolume / 100), name:"Volume"}
end tell
end tell
<?php
namespace gadgetron\doctrine;
use Doctrine\ORM\Events;
class EventSubscriber implements \Doctrine\Common\EventSubscriber
{
public function getSubscribedEvents()
{
<?php echo '<?'; ?>xml version="1.0" encoding="UTF-8"?>
<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
<channel>
<title>
<?php echo ucwords(basename(dirname($_SERVER['SCRIPT_NAME']))); ?><?php if (!empty($_GET['match'])): ?> : <?php echo ucwords($_GET['match']); ?><?php endif; ?>
</title>
<?php $files = scandir('.'); ?>
<?php $files = array_reverse($files); ?>
/**
* thanks to Mark Pilgrim:
* http://diveintohtml5.org/everything.html
* http://diveintohtml5.org/detect.html#techniques
*/
function check_html5_audio()
{
// avoid repeating the check unnecessarily
if (typeof browser_supports_html5_audio != "undefined")
{
#!/bin/bash
# Problem: DirectoryService crashes randomly. When this happens, AFP stops working until AFP is restarted.
#
# Workaround: This script looks for DirectoryService crashes, and upon detecting one, restarts AFP.
#
# Installation: Move this script to /usr/local/bin (or desired location) and chmod +x. Add to system crontab, run as root. I recommend running every minute to minimize AFP downtime, but the syslog command can be very resource-intensive, so it is ultimately at your discretion.
notify_email="[email protected]"
last_restart_file="/var/run/directoryservice_check_crash"
#!/usr/bin/env bash
for type in markdown md
do
for file in *.$type
do
if [ -f $file ]
then
if [ ! -d "markdown2html" ]
then
#!/bin/bash
# Apple has informed me that you should not use Time Machine for backing up a server.
# (Why it remains an option in System Preferences, despite not working correctly, is a mystery to me.)
# For further information, see Advanced_Server_Admin_v10.6.pdf, page 36.
# If you still want this script for some reason, see past revisions.
<?php
/**
* get current git revision
*/
if (sfConfig::get('sf_environment') != 'prod' && file_exists(sfConfig::get('sf_root_dir').'/../.git/logs/HEAD'))
{
$fp = fopen(sfConfig::get('sf_root_dir').'/../.git/logs/HEAD', 'r');
$pos = -2; $line = ''; $c = '';
#!/usr/bin/env bash
# config
date=`date "+%Y-%m-%d"`
git_binary=/usr/local/bin/git
# repositories in /git, space-separated.
repos="foo.git bar.git"
<?php
/**
* reorders an array based on the specified order of keys.
*
* @param array $array the array that should be reordered
* @param array $order the order that the keys in the first array should be in. each value should be a key from the first array. any elements from the first array that are not specified in the order will be inserted at the end of the returned array, in their original order.
*
* @return array
*/