Skip to content

Instantly share code, notes, and snippets.

View hostmaster's full-sized avatar
🏠
Working from home

Igor Khomyakov hostmaster

🏠
Working from home
  • Russia, Saint Petersburg
View GitHub Profile
@hostmaster
hostmaster / addsite.sh
Created April 5, 2012 08:26
Ubuntu 10.04 (nginx + php5-fpm): Install MODX 2.2 including user, virtual host, database
#!/bin/bash
# MySQL root password
ROOTPASS="password"
TIMEZONE="Europe/Moscow"
MYSQLPASS=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12`
SFTPPASS=`< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c12`
##############
@hostmaster
hostmaster / ideal ops.md
Created May 29, 2012 08:49 — forked from bhenerey/ideal ops.md
ideal ops checklist

In a perfect world, where things are done well, not just quickly, I would expect to find the following when joining the company:

Documentation

  • Accurate / up-to-date systems architecture diagram

  • Accurate / up-to-date network diagram

  • Out-of-hours support plan

  • Incident management plan

pid = /var/run/stunnel.pid
socket = a:SO_REUSEADDR=1
socket = l:TCP_NODELAY=1
socket = r:TCP_NODELAY=1
debug = 2
[ssl_frontend]
client = no
key = /WOO/server1024.key
cert = /WOO/server1024.crt
- name: Set the hostname in rc.conf
lineinfile: dest=/etc/rc.conf regexp="^hostname" line='hostname="{{ hostname }}"'
register: hostnamestatus
- name: Set the hostname
command: hostname {{ hostname }}
when: hostnamestatus.changed
#!/usr/bin/env python
# encoding: utf-8
"""
greenparser.py
A simple test script to measure the difference between
regular urllib2 downloads and gevent-based downloads.
"""
from gevent import monkey
monkey.patch_socket()
# Steps for turning on squid monitoring (until I have an rpm)
cat > /etc/collectd.d/squid << EOF
LoadPlugin exec
<Plugin exec>
Exec deploy "/var/lib/releng/monitoring/squid"
</Plugin>
EOF
mkdir -p /var/lib/releng/monitoring
@hostmaster
hostmaster / btsync.supervisor.conf
Last active December 26, 2015 21:29 — forked from MartinBrugnara/btsync.supervisor.conf
supervisord configuration for btsync
[program:btsync]
command=/opt/BTSync/bin/btsync --nodaemon --config /home/<%= btuser %>/.btsync/config
user=<%= btuser %>
umask=002
directory=/home/<%= btuser %>
redirect_stderr=true
stdout_logfile=/home/<%= btuser %>/.btsync/error.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=3
autorestart=true
### signal the start of configuration
- hosts: localhost
tasks:
- irc:
channel={{ irc_channel }} server={{ irc_server }} msg="Preparing to update the servers"
### configure each webserver
- hosts: webservers
def human_log(res):
fields = ['cmd', 'command', 'start', 'end', 'delta', 'msg', 'stdout', 'stderr']
for field in fields:
if field in res:
print '\n{0}:\n{1}'.format(field, res[field])
class CallbackModule(object):
def on_any(self, *args, **kwargs):
pass
@hostmaster
hostmaster / init.c
Created April 21, 2014 11:35 — forked from rofl0r/init.c
#define _XOPEN_SOURCE 700
#include <signal.h>
#include <unistd.h>
int main()
{
sigset_t set;
int status;
if (getpid() != 1) return 1;