Skip to content

Instantly share code, notes, and snippets.

View randallknutson's full-sized avatar

Randall Knutson randallknutson

View GitHub Profile
[alias]
st = status
co = checkout
cb = checkout
df = diff --no-prefix && git diff --staged --no-prefix --ignore-space-change
[apply]
whitespace = nowarn
[color]
ui = auto
diff = auto
@randallknutson
randallknutson / Redirect to node page after registration
Created February 27, 2013 16:35
Redirect after registration to node page
/**
* Implements hook_file_download()
*/
function mymodule_file_download($uri) {
$url = drupal_parse_url($_SERVER['HTTP_REFERER']);
// Strip out the server name.
$path = substr($url['path'], strpos($url['path'], $_SERVER['SERVER_NAME']) + strlen($_SERVER['SERVER_NAME']) + 1);
if ($path == 'user/login') {
// If we get here the user just logged or registered. If we simply
// return the file they will stay on the login page. We need to find the
@randallknutson
randallknutson / gist:5049544
Last active December 14, 2015 07:19
Solr Settings
/**
* Implements hook_default_search_api_server().
*/
function yourmodule_default_search_api_server() {
$items = array();
$host = variable_get('solr_search_api_host', 'localhost');
$port = variable_get('solr_search_api_port', '8983');
$path = variable_get('solr_search_api_path', '\\/solr');
@randallknutson
randallknutson / apc.ini
Created February 28, 2013 19:44
Production settings for apc.ini
extension=apc.so
apc.shm_size = 128M
apc.stat = 0
apc.ttl = 0
@randallknutson
randallknutson / varnish
Last active December 14, 2015 08:39
varnish config
# Configuration file for varnish
#
# /etc/init.d/varnish expects the variable $DAEMON_OPTS to be set from this
# shell script fragment.
#
START=yes
# Maximum number of open files (for ulimit -n)
NFILES=131072
@randallknutson
randallknutson / default.vcl
Last active December 14, 2015 08:39
Varnish default.vcl for drupal
# A drupal varnish config file for varnish 3.x
#
# Will work with Drupal 7 and Pressflow 6.
#
# Default backend definition. Set this to point to your content
# server. We are assuming you have a web server running on port 8080.
#
C{
#include <sys/time.h>
#include <stdio.h>
@randallknutson
randallknutson / Only allow basic traffic
Created February 28, 2013 21:42
iptables only allow web traffic. Stored in /etc/iptables.rules iptables-restore < /etc/iptables.downrules sudo sh -c "iptables-save -c > /etc/iptables.rules"
# Generated by iptables-save v1.4.12 on Fri Jan 4 21:46:44 2013
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [247:293129]
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -s 127.0.0.1/32 -p tcp -j ACCEPT
server {
listen 8080;
server_name example.com www.example.com;
root /var/www/example.com; ## <-- Your only path reference.
client_max_body_size 1024M;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_set_header X-Url-Scheme $scheme;
#!/bin/bash
# Makes sure we exit if flock fails.
set -e
(
# Wait for lock on /var/lock/.lockfile.lock (fd 200) for 10 seconds
flock -x -w 10 200
timeout 2h /command/to/run > /var/log/logfile 2>&1
diff --git a/core.css b/core.css
index 1ff29f3..98b9e9e 100644
--- a/core.css
+++ b/core.css
@@ -712,7 +712,6 @@ body.page-admin div.vertical-tabs .vertical-tabs-panes .vertical-tabs-pane field
.form-wrapper.form-actions input.form-submit, .form-wrapper.form-actions a.button { margin-right:5px; }
- .form-layout-default .column-main .form-actions { display:none; }
.form-layout-default .column-side .form-actions { margin:0px 0px 10px; }