Skip to content

Instantly share code, notes, and snippets.

View marzocchi's full-sized avatar

Federico Marzocchi marzocchi

View GitHub Profile
@marzocchi
marzocchi / config.ru
Created July 1, 2011 09:15
Run Symfony apps with Rack (rackup! pow!)
# vim:se filetype=ruby
# vim:se foldlevel=3
#
# Hacks and monkeys to run Symfony 1.4 applications as Rack apps using
# the rack-legacy and rack-rewrite gems.
#
# A couple of rack-rewrite rules take care of handing requests to the
# default front controller (index.php) and a subclass of rack-legacy's
# Php fixes PATH_INFO for Symfony routing.
#
@marzocchi
marzocchi / php.rb
Created August 18, 2011 16:22
PHP formula for homebrew
require 'formula'
class Php < Formula
url 'http://it.php.net/distributions/php-5.3.8.tar.gz'
homepage 'http://php.net/'
md5 'f4ce40d5d156ca66a996dbb8a0e7666a'
version '5.3.8'
# depends_on 'cmake'
depends_on 'mysql'
@marzocchi
marzocchi / vim.rb
Created August 18, 2011 16:27 — forked from uasi/vim.rb
Vim formula for Homebrew
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'ftp://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2'
head 'https://vim.googlecode.com/hg/'
sha256 '5c5d5d6e07f1bbc49b6fe3906ff8a7e39b049928b68195b38e3e3d347100221d'
version '7.3.206'
def features; %w(tiny small normal big huge) end
@marzocchi
marzocchi / desktop-icons.rb
Created September 27, 2011 21:47
Save and restore Finder's desktop icons position
#!/usr/local/bin/macruby
# Damn evil Finder will insist crashing and reshuffling
# icons in my carefully laid out desktop.
require 'rubygems'
require 'thor'
require 'yaml'
framework "ScriptingBridge"
$ ./tmux -C
./tmux: illegal option -- C
usage: tmux [-28lquvV] [-c shell-command] [-f file] [-L socket-name]
[-S socket-path] [command [flags]]
@marzocchi
marzocchi / own.sh
Created January 18, 2012 12:43
own
#!/bin/zsh
# curl https://raw.github.com/gist/1632835/own.sh | zsh
echo Installing packages
sudo apt-get install git zsh vim
echo Setting shell..
chsh -s /bin/zsh
#!/bin/zsh
# curl https://raw.github.com/gist/1632892/ranger.sh | zsh
curl http://nongnu.org/ranger/ranger-stable.tar.gz | tar xvz
cd ranger-1.5.2
sudo make install
@marzocchi
marzocchi / etc-init.d-graylog2.sh
Created January 23, 2012 01:59
init script for graylog2
#! /bin/sh
### BEGIN INIT INFO
# Provides: Graylog2
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts Graylog2
# Description: Starts Graylog2 using start-stop-daemon
### END INIT INFO
@marzocchi
marzocchi / gist:3227124
Created August 1, 2012 14:08
magic netbeans settings that apparently prevent it from hogging my mac
netbeans_default_options="-J-server -J-Xverify:none -J-d64 -J-Xss2m -J-Xms256m -J-Xmx512m -J-XX:PermSize=32m -J-XX:MaxPermSize=512m -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.opengl=true -J-Dsun.java2d.d3d=false -J-Dawt.nativeDoubleBuffering=true -J-XX:+UseAdaptiveSizePolicy -J-Djava.net.preferIPv4Stack=true -J-XX:+AggressiveOpts -J-XX:+AggressiveHeap -J-d64"
@marzocchi
marzocchi / controller.php
Created August 2, 2012 15:12
Change a Doctrine entity's table name at runtime
<?php
class FooController extends Controller {
function fooAction() {
$em = $this->getDoctrine()->getEntityManager();
$cm = $em->getClassMetadata('FooBundle:FooEntity');
$cm->setTableName('special_table_name');