Skip to content

Instantly share code, notes, and snippets.

View pablete's full-sized avatar

Pablo A. Delgado pablete

View GitHub Profile
# 1) Point *.example.com in your DNS setup to your server.
#
# 2) Setup an Apache vhost to catch the star pointer:
#
# <VirtualHost *:80>
# ServerName *.example.com
# </VirtualHost>
#
# 3) Set the current account from the subdomain
class ApplicationController < ActionController::Base
@pablete
pablete / request_start_variable.patch
Created March 4, 2012 15:22
Add a 'start_time' variable to nginx 1.0.10 to support an X-REQUEST-START header. This header is used by New Relic RPM to record queue time.
--- nginx-1.0.10/src/http/ngx_http_variables.c 2011-05-30 08:36:17.000000000 -0400
+++ nginx-1.0.10-patched/src/http/ngx_http_variables.c 2011-11-24 23:48:09.000000000 -0500
@@ -92,6 +92,8 @@
ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_pid(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t ngx_http_variable_start_time(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
/*
@pablete
pablete / 0-readme.md
Created November 22, 2012 17:18 — forked from burke/0-readme.md
ruby-1.9.3-p194 cumulative performance patch.

Patched ruby 1.9.3-p194 for 30% faster rails boot

Overview

This script installs a patched version of ruby 1.9.3-p194 with boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Many thanks to funny-falcon for the performance patches.

@pablete
pablete / index.html
Last active December 13, 2015 17:29 — forked from darwin/index.html
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/>
<script src="http://cmx.io/v/0.1/cmx.js"></script>
<body>
<scene id="scene1">
<label t="translate(0,346)">
<tspan x="0" y="0em">Powers</tspan>
</label>
<drawing t="translate(0,31)">
<line stroke="green">
@pablete
pablete / .bash_profile
Last active March 28, 2022 14:03 — forked from porras/.bash_profile
Change iTerm2 profile (ie: background color) when SSHing into another machine
# Changing iTerm2 color in MacOSX when SSHing (so you know at a glance that you're no longer in Kansas)
# Adapted from https://gist.github.com/porras/5856906
# 1. Create a theme in your terminal setting with the name "SSH" and the desired colors, background, etc.
# 2. Add this to your .bash_profile (or .bashrc, I always forget the difference ;))
# 3. Optional but useful: in the terminal, go to Settings > Startup and set "New tabs open with" to
# "default settings" (otherwise, if you open a new tab from the changed one, you get a local tab with
# the SSH colors)
function tabc() {
NAME=$1; if [ -z "$NAME" ]; then NAME="Default"; fi # if you have trouble with this, change
#/bin/bash
set -e
echo "=== Activating Firewall (only SSH allowed) ==="
ufw allow ssh
ufw --force enable
if [ ! -f /swapfile ]; then
echo "=== Activating swap ==="
fallocate -l 1G /swapfile
@pablete
pablete / gist:8326305
Last active January 2, 2016 15:49 — forked from zbal/gist:7800423
# Based on https://gist.github.com/fernandoaleman/5083680
# Guest Additions Version: 4.3.6
# VirtualBox Version: 4.3.6
$ vagrant ssh
vagrantup:~$ sudo apt-get install linux-headers-$(uname -r) build-essential
vagrantup:~$ sudo wget -c http://download.virtualbox.org/virtualbox/4.3.6/VBoxGuestAdditions_4.3.6.iso \
-O VBoxGuestAdditions_4.3.6.iso
vagrantup:~$ sudo mount VBoxGuestAdditions_4.3.6.iso -o loop /mnt
  1. General Background and Overview
/**
The MIT License (MIT)
Copyright (c) 2013 Jean Helou
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@pablete
pablete / index.html
Last active August 29, 2015 14:18 — forked from mbostock/.block
<!DOCTYPE html>
<meta charset="utf-8">
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var width = 960,
height = 500;
var colors = [