Skip to content

Instantly share code, notes, and snippets.

@joshdvir
joshdvir / gist:c03dbc69453a46ab3837
Last active August 29, 2015 14:14
HAproxy Faye
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
@joshdvir
joshdvir / app.yaml
Last active August 29, 2015 14:10 — forked from darktable/app.yaml
application: you-app-name-here
version: 1
runtime: python
api_version: 1
default_expiration: "30d"
handlers:
- url: /(.*\.(appcache|manifest))
mime_type: text/cache-manifest
@joshdvir
joshdvir / settings.php
Created June 19, 2014 08:11
Custom Error Page in Drupal 7 if DB is down
@$mysqli = new mysqli(
$databases['default']['default']['host'],
$databases['default']['default']['username'],
$databases['default']['default']['password'],
$databases['default']['default']['database']
);
if (mysqli_connect_error()) {
require_once DRUPAL_ROOT . '/error.inc';
exit();
}
@joshdvir
joshdvir / gist:cbddb70e6d98bdd7734a
Created May 15, 2014 10:36
Automating server inventory
# Automating server inventory
Some of the most useful information you will likely want to collect if you are maintaining a profile of each of the servers you manage includes:
* the server name
* its IP address
* the number of CPUs and cores
* the processor speed
* your disk sizes
* what OS is in use
# update your application db
apt-get update
# install dependencies
sudo apt-get install build-essential libcurl4-openssl-dev
# clone the cpuminer vertcoin repository
git clone https://github.com/Bufius/cpuminer-vert.git
# cd into it
<%
def hellow_tumblr
puts "Welcome to my new Tumblr blog"
end
%>
@joshdvir
joshdvir / chef_solo_bootstrap.sh
Created August 30, 2012 18:47
Bootstrap Chef Solo - for Ubuntu 12.04
#!/usr/bin/env bash
apt-get -y update
apt-get -y -f install build-essential
apt-get -y install ruby1.9.1 rubygems1.9.1 ri1.9.1 rdoc1.9.1 ruby1.9.1-dev g++ irb1.9.1 libopenssl-ruby1.9.1 openssl
gem install chef right_aws --no-ri --no-rdoc
@joshdvir
joshdvir / optimize_schema.rb
Created April 11, 2012 07:26
Ruby optimize all tables in all DB's in mysql
require 'mysql'
con = Mysql.new('localhost','root', '')
rs = con.query('show databases')
databases = []
rs.each_hash do |h|
databases << h['Database']
end
databases.each do |db|
@joshdvir
joshdvir / gitconfig
Created March 17, 2012 20:24 — forked from bryanl/gitconfig
gitconfig
# put this at ~/.gitconfig
[alias]
# I'm lazy, so two letters will always trump the full command
co = checkout
ci = commit
cp = cherry-pick
st = status
br = branch
@joshdvir
joshdvir / delete_orig.rb
Created March 5, 2012 15:30
Delete orig files created from git merge
Dir.glob('./**/*.orig') do |file|
File.delete(file)
end