Skip to content

Instantly share code, notes, and snippets.

@pix0r
pix0r / Delete Playlists.scpt
Created February 19, 2012 20:47
Delete *.m3u and *.pls under current Finder directory
-- Path of script:
-- tell application "Finder" to get POSIX path of ((container of (path to me)) as text)
-- Foreground Finder window:
tell application "Finder" to get POSIX path of ((the target of the front window) as text)
set currDir to quoted form of result
set cmdBase to "find " & currDir & " \\( -name \\*.m3u -or -name \\*.pls \\)"
set cmdList to cmdBase & " -exec basename {} \\;"
set cmdCount to cmdBase & " | wc -l"
@pix0r
pix0r / localized_nibs_config.py
Created August 24, 2011 18:13
Automates the process of updating localized NIB files
#!/usr/bin/env python
locales = ["en", "fr", "it", "de", "es"]
dev_locale = "en"
base_dir = "ProjectSourceDirectory"
nibs = [
"MainWindow.xib",
"Error/ErrorViewController.xib",
"Home/HomeViewController.xib",
"Home/SettingsViewController.xib",
@pix0r
pix0r / CustomTextView.h
Created July 10, 2011 18:51
CustomTextView (UITextView subclass with border)
//
// CustomTextView.h
//
// Created by Mike Matz on 7/10/11.
// Copyright 2011 Flying Yeti. All rights reserved.
//
#import <Foundation/Foundation.h>
@pix0r
pix0r / output.txt
Created September 25, 2015 13:50
unscientific test of different foreach syntax
$ php test.php
Running 10 tests of 5000 iterations
finished 1 of 10
finished 2 of 10
finished 3 of 10
finished 4 of 10
finished 5 of 10
finished 6 of 10
finished 7 of 10
finished 8 of 10
@pix0r
pix0r / create-transport-stream.sh
Created April 2, 2011 01:37
Convert MPEG audio or video into MPEG Transport Stream (simple ffmpeg commandline)
#!/bin/sh
IN=$1
OUT=$2
if [ "$IN" = "" ]; then
echo "Convert MPEG audio or video into MPEG Transport Stream"
echo "Usage: $0 <infile> [outfile]"
exit
fi
/**
* Added to override the default parse_str(php://input)
*/
if (!empty($_SERVER['REQUEST_METHOD'])
&& in_array($_SERVER['REQUEST_METHOD'], array('GET', 'POST')) === false
&& empty($_POST)) {
// Store original request
$input = file_get_contents('php://input');
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.displays"
end tell
tell application "System Events" to tell window 1 of process "System Preferences"
try
tell tab group 1 to click radio button "Arrangement"
on error
return "Only one display available."
end try
<?php defined('SYSPATH') or die('No direct script access.');
//-- Environment setup --------------------------------------------------------
/**
* Set the default time zone.
*
* @see http://docs.kohanaphp.com/about.configuration
* @see http://php.net/timezones
*/
<?php
define('REPOSITORY_PATH', "/path/to/svn/repo");
// Note: You'll need to set this part up yourself :)
define('NOTIFY_URL', 'http://site.com/notify.php?rev=%rev%&author=%author%&msg=%msg%');
define('PATH_IDEAL_LEN', 30);
define('PATH_MAX_LEN', 50);
$argv = $_SERVER['argv'];
$argc = $_SERVER['argc'];
#!/bin/sh
#
# svn-revs-tortoise-to-cmdline.sh
#
# converts merges from TortoiseSVN-type format to individual svn merge commands.
# mergefile should contain a newline-delimited list of the revision list that TortoiseSVN
# outputs. Eg: "1,3,6-8,11,15" should be "1\n3\n6-8\n11\n15"
trunk=http://my.repo/trunk
mergefile=merges.txt