Skip to content

Instantly share code, notes, and snippets.

<VirtualHost *:80>
ServerName mail.inodes.org
RewriteEngine On
RewriteRule ^/(.*) https://mail.inodes.org/
</VirtualHost>
<VirtualHost 192.168.223.31:443>
ServerName mail.inodes.org
[user]
name = John Ferlito
email = johnf@inodes.org
[color]
branch = auto
diff = auto
interactive = auto
ui = true
pager = true
// A
enum _foo_type {
FOO
};
typedef enum _foo_type foo_type;
// B
typedef enum {
BAR
@johnf
johnf / gist:1363386
Created November 14, 2011 06:32
Pass argc to exec
#include <unistd.h>
int main(int argc, char *argv[]) {
execv("/bin/ls", argv);
}
@johnf
johnf / gist:1496171
Created December 19, 2011 08:57
php-fastcgi
# php-fastcgi - Manages php5-cgi in FastCGI mode
description "Manage a PHP FastCGI process"
start on (net-device-up
and local-filesystems
and runlevel [2345])
stop on runlevel [016]
env PHP_FCGI_CHILDREN=8
@johnf
johnf / gist:1496601
Created December 19, 2011 10:49
new relic example
require 'newrelic_rpm'
# https://support.newrelic.com/help/discussions/support/7631-not-seeing-database-data
NewRelic::Agent.add_instrumentation(File.join(Gem.loaded_specs['newrelic_rpm'].full_gem_path, "lib/new_relic/agent/instrumentation/rails3/active_record_instrumentation.rb"))
# From lib/new_relic/agent/instrumentation/rails3/active_record_instrumentation.rb
require 'new_relic/agent/instrumentation/rails3/active_record_instrumentation'
ActiveRecord::ConnectionAdapters::AbstractAdapter.module_eval do
include ::NewRelic::Agent::Instrumentation::ActiveRecordInstrumentation
end
ActiveRecord::Base.class_eval do
orker_processes 4
working_directory '/srv/www/vqdata/current'
listen '/srv/www/vqdata/shared/pids/unicorn.socket'
pid '/srv/www/vqdata/current/tmp/pids/unicorn.pid'
stderr_path '/srv/www/vqdata/shared/log/unicorn.stderr.log'
stdout_path '/srv/www/vqdata/shared/log/unicorn.stdout.log'
preload_app true
#!/usr/bin/perl
use DateTime;
use Date::Parse;
my $e1 = str2time($ARGV[0]);
my $e2 = str2time($ARGV[1]);
$d1 = DateTime->from_epoch( epoch => $e1 )->set_time_zone('floating');;
$d2 = DateTime->from_epoch( epoch => $e2 )->set_time_zone('floating');;
data = [
[-19, -31, 61, -66, -6, 104, 358, -165, 181, -5, -75, 42, 111, 685, 42, 105, 70, 151, 130, 318, 289, 106, 135, 816, 108, 275, 57, 150, 19, -18, 11, -19, 1115, 614, -49, 45, 415, 305, 623, 76, 173, 103, 58, 36, 10, 14, 21, -72, -38, 116, 99, 18, 85, 96, 91, -8, 82, -5, 1, 68, 67, 95, 97, 83, 20, 92, 418, 58, 1072, -854, -590, -1002, 1, -18, 53, -240, 191, 224, 172, 3, -217, 5, -126, 23, 31, 11, 119, 149, 21, -2, 68, -46, 472, 227, 315, 204, 32, 73, 199, 209, 99, 6, 41, 36, -120, -11, -101, 96, -235, 11, 65, -10, 5, 56, 173, 3854, -32, 98, 12, 191, 138, 94, 164, 31, 145, 245, 83, -47, 36, -59, -110, -61, -147, -4, 167, 89, 80, 485, 65, 30, 133, -1, 152, -54, 24, 38, 210, 105, 98, -23, 66, 99, 121, 153, 532, 112, 141, 125, 81, 333, 16, 153, 282, 44, 415, -5, 509, 169, 93, 339, 8, 27, -264, -706, -558, -33, -52, 68, -72, 40, 7, 91, 297, 54, 228, 174, 11, 1, 69, -102, -121, 2, 1259, 1366, 291, 17, 67, 122, 90, -663, 100, 399, 12, 221, 86, -744, -347, -150, -40, 133, 847, 144, 72, 7, 361, -46, 290, 138,
name = 'mp-tst-02'
vim = @compute.instance_variable_get :@connection
rootFolder = vim.serviceInstance.content.rootFolder
propertyCollector = vim.serviceInstance.content.propertyCollector
# Traversal to get to the vmFolder from DataCenter
dataCenterToVMFolder = RbVmomi::VIM::TraversalSpec(
:name => 'DataCenterToVMFolder',