Skip to content

Instantly share code, notes, and snippets.

View antonio's full-sized avatar

Antonio Santos antonio

View GitHub Profile
@antonio
antonio / autoflag.scpt
Last active November 10, 2017 19:20
Flag things that I need to do today and unflag things that I don't in Omnifocus
on run
tell application "OmniFocus"
set todayDate to current date
set todayDate's hours to 0
set todayDate's minutes to 0
set todayDate's seconds to 0
set tomorrowDate to todayDate + 1 * days
tell default document
@antonio
antonio / docker.yml
Created May 15, 2014 10:20
Install docker
---
- hosts: all
remote_user: antonio
sudo: yes
tasks:
- name: ensure apt can deal with https
apt: name=apt-transport-https state=present
- name: add the docker repository
apt_repository: repo='deb https://get.docker.io/ubuntu docker main' state=present
- name: update the system
def fill_in_select2(selector, options={})
container = "#s2id_#{selector}"
page.find("#{container} a").click
page.find(".select2-search input.select2-input").set options[:with]
page.first(".select2-match").click
end
@antonio
antonio / custom_plan.rb
Created March 10, 2013 11:41
Fix notifications when guard runs on top of zeus
require 'zeus/rails'
require 'guard'
require 'guard/cli'
class CustomPlan < Zeus::Rails
def guard
Guard::CLI.start
end
@antonio
antonio / delete_rebased_and_merged_branches.sh
Created January 21, 2013 14:58
Delete branches that were rebased (reference never updated) and merged into master
#!/bin/sh
for branch in $(git branch -a | sed 's/^\s*//' | sed 's/^remotes\///' | grep -v 'master$'); do
last_commit_msg="$(git log --oneline --format=%f -1 $branch)"
if [[ "$(git log --oneline --format=%f | grep $last_commit_msg | wc -l)" -eq 1 ]]; then
if [[ "$branch" =~ "origin/" ]]; then
local_branch_name=$(echo "$branch" | sed 's/^origin\///')
if [[ -n "$EXEC" ]]; then
git push origin :$local_branch_name
else
@antonio
antonio / delete_branches_older_than.sh
Created January 21, 2013 14:29
Script to delete branches older than a certain date
#!/bin/sh
date=$1
for branch in $(git branch -a | sed 's/^\s*//' | sed 's/^remotes\///' | grep -v 'master$'); do
if [[ "$(git log $branch --since $date | wc -l)" -eq 0 ]]; then
if [[ "$branch" =~ "origin/" ]]; then
local_branch_name=$(echo "$branch" | sed 's/^origin\///')
if [[ "$DRY_RUN" -eq 1 ]]; then
echo "git push origin :$local_branch_name"
@antonio
antonio / 0-readme.md
Created December 13, 2012 14:40 — forked from burke/0-readme.md

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@antonio
antonio / fix_asset_not_precompiled_error.rb
Created November 19, 2012 16:14
Avoid Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError
# This file monkey patches the Rails include helpers to prevent them from
# failing with an AssetNotPrecompiled error. This should be fixed in
# Rails 4.x and by then we should delete this file
module Sprockets
module Helpers
module RailsHelper
alias_method :original_stylesheet_link_tag, :stylesheet_link_tag
alias_method :original_javascript_include_tag, :javascript_include_tag
alias_method :original_image_path, :image_path
@antonio
antonio / movierenamer.rb
Created October 25, 2012 10:19
Automatically rename movies according to XBMC standards (adapt to your needs)
#!/usr/bin/env ruby
require 'osdb'
require 'fileutils'
server = OSDb::Server.new(
:host => 'api.opensubtitles.org',
:path => '/xml-rpc',
:timeout => 90,
:useragent => "SubDownloader 2.0.10" # register useragent ? WTF ? too boring.
@antonio
antonio / 1.9.3-p286-perf
Created October 22, 2012 17:32
Ruby 1.9.3-p286 with the latest falcon patch
build_package_combined_patch() {
local package_name="$1"
{
curl https://raw.github.com/gist/3721565/falcon.patch | patch -p1
autoconf
./configure --prefix="$PREFIX_PATH" $CONFIGURE_OPTS
make -j 8
make install
} >&4 2>&1