Skip to content

Instantly share code, notes, and snippets.

@tjstein
tjstein / vcl.vim
Created October 12, 2010 02:43
vcl.vim
" Vim syntax file
" Filename: vcl.vim
" Language: Varnish configuation Language, http://www.varnish-cache.org/wiki/VCL
" Maintainer: Elan Ruusamäe <glen@delfi.ee>
" Version Info: $Revision: 1.7 $
" Last Change: $Date: 2010/04/06 08:24:28 $ UTC
" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
@tjstein
tjstein / nginx
Created September 14, 2010 08:18
nginx
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
#!/bin/bash
##
## are you root?
##
if [ "$(whoami)" != "root" ]; then
echo "You need to be root to run this!"
exit 2
fi
@tjstein
tjstein / apachetest.sh
Created September 1, 2010 19:05
Find out what Apache MaxClients should be set to
#!/bin/bash
echo "This is intended as a guideline only!"
if [ -e /etc/debian_version ]; then
APACHE="apache2"
elif [ -e /etc/redhat-release ]; then
APACHE="httpd"
fi
RSS=`ps -aylC $APACHE |grep "$APACHE" |awk '{print $8'} |sort -n |tail -n 1`
RSS=`expr $RSS / 1024`
echo "Stopping $APACHE to calculate free memory"
add-apt-repository ppa:brianmercer/php
aptitude -y update
aptitude -y install php5-cli php5-common php5-mysql php5-suhosin php5-gd php5-curl
aptitude -y install php5-fpm php5-cgi php-pear php5-memcache php-apc php5-dev
echo "apc.mmap_file_mask=/tmp/apc.XXXXXX" >> /etc/php5/conf.d/apc.ini
echo "apc.shm_size = 64" >> /etc/php5/conf.d/apc.ini
cp /etc/php5/fpm/php5-fpm.conf /etc/php5/fpm/php5-fpm.conf.original
sed -i 's/.*listen.allowed_clients = 127.0.0.1.*/listen.allowed_clients = 127.0.0.1/g' /etc/php5/fpm/php5-fpm.conf
@tjstein
tjstein / memcached_size
Created May 16, 2010 20:34
memcached_size
#!/usr/bin/perl -w
#
# Copyright (C) 2008 Rodolphe Quiedeville <rodolphe@quiedeville.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2 dated June,
# 1991.
#
# This program is distributed in the hope that it will be useful,
@tjstein
tjstein / memcached
Created May 16, 2010 20:33
memcached
#!/usr/bin/perl -w
#
# Copyright (C) 2008 Rodolphe Quiedeville <rodolphe@quiedeville.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2 dated June,
# 1991.
#
# This program is distributed in the hope that it will be useful,
@tjstein
tjstein / apc
Created May 16, 2010 20:19
apc
#!/usr/bin/perl
#
# Magic markers:
#%# family=auto
#%# capabilities=autoconf
my $ret = undef;
if (! eval "require LWP::UserAgent;")
{
@tjstein
tjstein / memcached_hits
Created May 16, 2010 20:34
memcached_hits
#!/usr/bin/perl -w
#
# Copyright (C) 2008 Rodolphe Quiedeville <rodolphe@quiedeville.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2 dated June,
# 1991.
#
# This program is distributed in the hope that it will be useful,
@tjstein
tjstein / varnish_
Created May 16, 2010 21:15
varnish_
#!/usr/bin/perl -w
#
# varnish_ - Munin plugin to for Varnish
# Copyright (C) 2009 Redpill Linpro AS
#
# Author: Kristian Lyngstøl <kristian@redpill-linpro.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or