Skip to content

Instantly share code, notes, and snippets.

View carlosmcevilly's full-sized avatar

Carlos McEvilly carlosmcevilly

View GitHub Profile
@carlosmcevilly
carlosmcevilly / uicolor-to-image.pl
Created December 21, 2011 21:26
UIColor to image, using Perl and ImageMagick. This is just scary ugly. Next time I'll do it with Cocoa.
#!/usr/bin/perl
use strict;
use warnings;
my $token;
my @tokens;
my ($num, $denom, $value, $hexcolor);
my $outfile = "result.png";
@carlosmcevilly
carlosmcevilly / gist:1881721
Last active September 28, 2021 05:22
split a .mov file without loss of quality
#!/usr/bin/perl
# command from:
# http://www.linuxquestions.org/questions/linux-newbie-8/how-do-you-split-mpg-files-using-a-ffmpeg-command-542607/
# -vcodec copy copies the raw data
# -ss start seconds?
# -to ?
my $infile = shift;
if (typeof (AC) === "undefined") {
AC = {}
}
AC.ImageReplacer = Class.create({
_defaultOptions: {
listenToSwapView: true,
filenameRegex: /(.*)(\.[a-z]{3}($|#.*|\?.*))/i,
filenameInsert: "_☃x",
ignoreCheck: /(^http:\/\/movies\.apple\.com\/|\/105\/|\/global\/elements\/quicktime\/|_(([2-9]|[1-9][0-9]+)x|nohires)(\.[a-z]{3})($|#.*|\?.*))/i,
attribute: "data-hires",
@carlosmcevilly
carlosmcevilly / gist:2221249
Last active April 3, 2025 12:47
fix git commit with wrong email address in git config, before pushing
If:
- you add and commit with the wrong email address in git, and
- your remote has a hook set up to prevent you from pushing with the bad address
Then you need to amend the author of your commit before push can succeed:
1. fix your email address in git config:
$ git config user.name "Your Name"
@carlosmcevilly
carlosmcevilly / gist:2221332
Created March 27, 2012 23:10
xcode-select command now that dev tools are no longer in /Developer
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
# tags: scripting testing www script browser ruby automation webdev safari
# tags: watir
# update gem
sudo gem update --system
# check gem version
gem -v
# install safariwatir
@carlosmcevilly
carlosmcevilly / hack.sh
Created March 31, 2012 17:17 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with useful tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@carlosmcevilly
carlosmcevilly / bash-function-work-navigation.sh
Last active June 14, 2020 03:34
bash function to cd to work/<year>/ directory
# Navigate top-level work/year project organization directories
#
# Setup:
# Put or source function in .bashrc
# Also set WORK_ROOT to point to a container directory such as ~/work
# Make a directory under that for at least the current year, e.g. ~/work/2020
#
# Usage examples:
# $ work # cd to the current year
# $ work -- # cd two years back. Or --- for three years, etc.
@carlosmcevilly
carlosmcevilly / gist:2295872
Created April 3, 2012 22:18
bash function to view man pages using Preview.app
# put in .bashrc
pman () {
if [ "${2}" == '' ]; then
man -t "${1}" | open -f -a /Applications/Preview.app
else
man -t "${1}" "${2}" | open -f -a /Applications/Preview.app
fi
}
# add 'source .gitprompt' to .bashrc to use this
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function proml {
local BLUE="\[\033[0;34m\]"
local RED="\[\033[0;31m\]"
local LIGHT_RED="\[\033[1;31m\]"