Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

service "opscenter-agent" do
supports :status => true
start_command "#{agent_dir}/bin/opscenter-agent"
status_command "ps aux | grep -q '[o]pscenter-agent'"
stop_command "kill $(ps aux | grep '[o]pscenter-agent' | awk '{print $2}')"
action :start
end
@gansbrest
gansbrest / gist:7089886
Created October 21, 2013 19:56
Sample grok entry
1382383761.140 38.96.155.45 - 2013-10-21T19:29:21+00:00 GET /sites/all/modules/admin/includes/admin.toolbar.js?Q HTTP/1.1 200 1616 "http://www.fastcompany.com/account/skhaladzinski" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/28.0.1500.71 Chrome/28.0.1500.71 Safari/537.36" US 0.001 "-" www.fastcompany.com 6dfca709
input {
file {
'path' => '/path/to/file.log'
'type' => 'fcd6_nginx_access'
}
}
@gansbrest
gansbrest / nodejs_lazyloading
Created January 22, 2013 18:35
Nodejs submodules lazyloading, could be very useful for private modules repos
// Nodejs submodules lazyloading, very useful for private modules repos
// where you don't want to create separate repo for evey module
// using this snippet, you can create one main repo for private modules
// and create submodules inside subfolder with the same name.
var fs = require('fs');
exports.answer = 42; // Some existing property
// This is how you would do it without lazy loading
// basically u would need to require every submodule right away
@gansbrest
gansbrest / gist:4145077
Created November 25, 2012 19:56
Drupal 6 simpletest curl patch ( curl spits output to stdout instead of saving to variable )
diff --git a/sites/all/modules/simpletest/drupal_web_test_case.php b/sites/all/modules/simpletest/drupal_web_test_case.php
index 9a9c360..fb67fba 100644
--- a/sites/all/modules/simpletest/drupal_web_test_case.php
+++ b/sites/all/modules/simpletest/drupal_web_test_case.php
@@ -1310,6 +1310,11 @@ class DrupalWebTestCase extends DrupalTestCase {
if (!isset($this->curlHandle)) {
$this->curlHandle = curl_init();
+
+ if (empty($this->cookieFile)) {
@gansbrest
gansbrest / rvm-install-chef-solo
Created November 4, 2012 22:56
Rvm install chef-solo
#!/bin/bash
# Install RVM
\curl -L https://get.rvm.io | sudo bash -s stable
# Add user to a group
# Todo: Remove hardcoding
sudo usermod -a -G rvm ubuntu
# Trying to avoid logout / login part here
server
{
# To avoid changing your app config
# point Nginx to the Solr port
listen 8983;
# Set read/write variables
set $solr_write "0";
set $solr_read "1";
set $solr_admin "0;
<?php
echo "TEST";
if ($argv[1]) {
sleep(10);
echo "RUN AGAIN";
exit;
}
containers:
php-nginx:
background: false
image: gansbrest/php5.3
workdir: "/app"
onetime: true
environment:
XDEBUG_CONFIG: idekey=PHPSTORM
ports:
- 9999:9999
@gansbrest
gansbrest / gist:7b8c5138bfcb48d4192e
Last active August 29, 2015 14:23
http_host_proxy.patch
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 80b6eb1..5b28e98 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -333,7 +333,15 @@ function conf_path($require_settings = TRUE, $reset = FALSE) {
$confdir = 'sites';
$uri = explode('/', $_SERVER['SCRIPT_NAME'] ? $_SERVER['SCRIPT_NAME'] : $_SERVER['SCRIPT_FILENAME']);
- $server = explode('.', implode('.', array_reverse(explode(':', rtrim($_SERVER['HTTP_HOST'], '.')))));
+
@gansbrest
gansbrest / gist:586265cdefac9e9674e7
Created June 18, 2015 15:24
scrip_name_proxy.patch
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 5b28e98..a9b3410 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -438,7 +438,14 @@ function conf_init() {
// $_SERVER['SCRIPT_NAME'] can, in contrast to $_SERVER['PHP_SELF'], not
// be modified by a visitor.
- if ($dir = trim(dirname($_SERVER['SCRIPT_NAME']), '\,/')) {
+