Skip to content

Instantly share code, notes, and snippets.

View guilhermechapiewski's full-sized avatar

Guilherme Chapiewski guilhermechapiewski

View GitHub Profile
@guilhermechapiewski
guilhermechapiewski / gist:6066682
Created July 23, 2013 22:21
Creates a "git lg" alias that displays a pretty nicely formatted git log output.
git config --global alias.lg=log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
//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);
@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
@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 / 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 / mysql_to_omnigraffle.applescript
Created September 27, 2010 18:23
AppleScript to dump MySQL tables to OmniGraffle Pro.
(*
Copyright (c) 2008, Christian Mittendorf <christian.mittendorf@googlemail.com>
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 / 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 / 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 / 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 / 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)
//]]>