Skip to content

Instantly share code, notes, and snippets.

View guilhermechapiewski's full-sized avatar

Guilherme Chapiewski guilhermechapiewski

View GitHub Profile
@guilhermechapiewski
guilhermechapiewski / execute_builds_on_git_push.sh
Created April 1, 2009 22:49
This script is used to execute a build on Integrity (http://integrityapp.com) every time there is a git push.
#!/bin/bash
FILE=vinagrette.last_commit.id
LAST_COMMIT=`cat $FILE`
ACTUAL_COMMIT=`git ls-remote git://git.globoi.com/vinagrette/mainline.git master | cut -f1`
if [ "$ACTUAL_COMMIT" != "$LAST_COMMIT" ]; then
wget http://macaco.globoi.com/vinagrette/builds --post-data="" -t 1 -q
wget http://macaco.globoi.com/vinagrette-acceptancetests/builds --post-data="" -t 1 -q
fi
@guilhermechapiewski
guilhermechapiewski / gist:91290
Created April 7, 2009 15:30 — forked from sr/gist:91275
Integrity auto-refresher
#!/usr/bin/env ruby
require "rubygems"
require "integrity"
class Refresher
JS = <<-EOS
<script type="text/javascript">
//<![CDATA[
setTimeout('location.reload()', %s * 1000)
//]]>
@guilhermechapiewski
guilhermechapiewski / gist:357027
Created April 5, 2010 23:52
ffmpeg line that converts MPEG-2 video to Vimeo format with HD quality
# Vimeo requirements for HD video:
# -r 30 --> 30 frames per second
# -b 5000k --> bitrate = 5000 k
# -s 1920x1080 --> sets output size
# -vcodec libx264 --> encodes using h.264
ffmpeg -i ~/Desktop/source.mpg -deinterlace -r 30 -b 5000k -vcodec libx264 -vpre libx264-hq -s 1920x1080 ~/Desktop/destination.mp4
@guilhermechapiewski
guilhermechapiewski / github_wiki_toc.js
Created April 26, 2010 15:28 — forked from tekkub/github_wiki_toc.js
Create a "Table of Contents" in your Github wiki
$(function () {
var toc = $("<ul>").css("margin-bottom", "20px !important");
$("div.main div.wikistyle h2").each(function() {
var id = $(this).text().replace(/\s+/g, "_").replace(/[^0-9a-zA-Z_.-]/g, "")
$(this).attr("id", id)
toc.append(
$("<li>").append($("<b>").append($("<a>").attr("href", "#" + id).text($(this).text())))
)
});
$("div.wikistyle").prepend(toc).prepend($("<h2>").text("Table of Contents"));
@guilhermechapiewski
guilhermechapiewski / github_toc.js
Created May 6, 2010 00:31
Create "Table of contents" in Github wiki for H1 and H2 items.
$(function () {
var toc = $("<ul>").css("margin-bottom", "20px !important");
$("div.main div.wikistyle h1,h2").each(function() {
var id = $(this).text().replace(/\s+/g, "_").replace(/[^0-9a-zA-Z_.-]/g, "")
$(this).attr("id", id)
if (this.tagName == "H1") {
toc.append(
$("<li>").append($("<b>").append($("<a>").attr("href", "#" + id).text($(this).text())))
)
} else {
@guilhermechapiewski
guilhermechapiewski / mysql_to_omnigraffle.applescript
Created September 27, 2010 18:23
AppleScript to dump MySQL tables to OmniGraffle Pro.
(*
Copyright (c) 2008, Christian Mittendorf <[email protected]>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list ofconditions and the following disclaimer. Redistributions in binary form
must reproduce the above copyright notice, this list of conditions and the
@guilhermechapiewski
guilhermechapiewski / gist:777937
Created January 13, 2011 14:31
Measure website response time through curl
curl -w '\nLookup time:\t%{time_namelookup}\nConnect time:\t%{time_connect}\nPreXfer time:\t%{time_pretransfer}\nStartXfer time:\t%{time_starttransfer}\n\nTotal time:\t%{time_total}\n' -o /dev/null -s 'http://gc.blog.br'
@guilhermechapiewski
guilhermechapiewski / colored_tail.sh
Created February 5, 2011 05:22
"tail -f" a log archive with colored output
#!/bin/bash
# Usage: colored_tail.sh [logfile]
tail -f ${1} | perl -pe 's/^\[DEBUG\].*$/\e[35m$&\e[0m/g;s/^\[INFO\].*$/\e[36m$&\e[0m/g;s/^\[WARN\].*$/\e[33m$&\e[0m/g;s/^\[ERROR\].*$/\e[31m$&\e[0m/g;'
@guilhermechapiewski
guilhermechapiewski / Makefile
Created April 6, 2011 03:26
Utility scripts to start Titanium Mobile projects from the command line.
PROJECT_ROOT=$(shell pwd)
PROJECT_NAME=SampleApp
run:
@echo "Building with Titanium..."
@mkdir -p ${PROJECT_ROOT}/${PROJECT_NAME}/build/iphone/
@PROJECT_NAME=${PROJECT_NAME} PROJECT_ROOT=${PROJECT_ROOT} DEVICE_TYPE=iphone bash ${PROJECT_ROOT}/bin/titanium.sh
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);