Skip to content

Instantly share code, notes, and snippets.

@ifnull
ifnull / gist:5732485
Last active December 18, 2015 05:28
Fix brew update that results in message ... "Your local changes to the following files would be overwritten by merge"
cd /usr/local
sudo chown -R `whoami`:admin ./
git reset --hard
git clean -fd
cd ~
find /usr/local/Library/Formula -type l -delete
brew doctor
brew update
brew prune
brew cleanup
@ifnull
ifnull / gist:5761255
Last active October 26, 2020 00:20
git add alias for git annex that excludes selected file extensions from master and adds them to annex.
#######################
# Setup
#######################
mkdir annex-test
cd annex-test
git init
git annex init master
#######################
# Fab setup task
@ifnull
ifnull / T3licensing.pm
Last active December 18, 2015 11:58
FlashVideo::Site:: module for get-flash-videos
# Part of get-flash-videos. See get_flash_videos for copyright.
package FlashVideo::Site::T3licensing;
use strict;
use FlashVideo::Utils;
sub find_video {
my ($self, $browser, $embed_url) = @_;
my $metadata = { };
my @url = ($browser->uri->as_string =~ /^((http[s]?|ftp):\/)?\/?([^:\/\s]+)((\/\w+)*\/)([\w\-\.]+[^#?\s]+)(.*)?(#[\w\-]+)?$/);
@ifnull
ifnull / gist:6102790
Last active December 20, 2015 08:49
Get octal permissions
# Linux
stat -c "%a %n" ~/
# OSX
stat -f %Mp%Lp ~/
@ifnull
ifnull / gist:6107915
Last active December 20, 2015 09:29
Break out of broken SSH terminal
[ENTER] ~ .
@ifnull
ifnull / multilineImageFTText.php
Last active December 20, 2015 15:19
Multi-line imagefttext method
<?php
public function multilineImageFTText($canvas, $fontSize, $font, $color, $copy, $start_x, $start_y, $width, $alignment)
{
// Holds lines
$strings = array();
// Placeholder for first element
$strings[] = '';
// Split copy into array using space
@ifnull
ifnull / gist:6208270
Created August 12, 2013 04:35
Fix file and folder permissions.
find ./ -type d -exec chmod 755 {} \;
find ./ -type f -exec chmod 644 {} \;
@ifnull
ifnull / gist:6264830
Created August 19, 2013 00:22
Clear Apache log
truncate -s 0 /path/to/log.log
@ifnull
ifnull / gist:6265357
Created August 19, 2013 02:37
Get ZF2 application config data
<?php
$this->getServiceLocator()->get('ApplicationConfig');
@ifnull
ifnull / gist:6279504
Last active December 21, 2015 08:38
Encode videos for Vine
1. Download http://handbrake.fr/rotation.php?file=HandBrake-0.9.9-MacOSX.6_CLI_x86_64.dmg
2. Mount HandBrake-0.9.9-MacOSX.6_CLI_x86_64.dmg
3. Copy HandBrakeCLI to /Applications/HandBrakeCLI