Skip to content

Instantly share code, notes, and snippets.

View eignatov's full-sized avatar
💻
typing...

eignatov

💻
typing...
View GitHub Profile
# First do a fresh install of CentOS 5.7 i386, server configuration (no GUI)
# This should be performed as root since it's going to be installing a bunch of stuff
# --- Update things to make sure we have the latest patches ---
# Add EPEL so we can get reasonably recent packages
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# --- Install all the packages --- #
yum -y install python-whisper python-carbon graphite-web python-memcached python-ldap httpd memcached
# vim: set ft=pf
# /etc/pf.conf
ext_if="vtnet0"
webports = "{http, https}"
int_tcp_services = "{domain, ntp, smtp, www, https, ftp}"
int_udp_services = "{domain, ntp}"
set skip on lo
#!/bin/sh
#
# Build a chroot with a CentOS 6.5 base install.
#
CHROOT=/tmp/chroot
mkdir -p $CHROOT
mkdir -p $CHROOT/var/lib/rpm
# Shutdown the VM and rename storage (optional)
$ virsh shutdown old_vm
$ mv /path/to/old_vm.img /path/to/new_vm.img
# Edit virsh template with the new name and storage
$ virsh dumpxml old_vm > new_vm.xml
$ vim new_vm.xml
~~~ new_vm.xml
<name>new_vm</name> # <-- change this line
...
@eignatov
eignatov / exim_clean.sh
Created January 26, 2016 13:45
Clean Exim
#!/bin/bash
# Определяем qualify_domain — он необходим для удаления всяческого мусора
domain=`exim -bP | grep -i "^qualify_domain" | sed -e s/.*\=\ //g`
# Прощаемся со всеми замороженными сообщениями
exim -bpr | grep '<' | awk '{print $2}' | grep '-' | xargs exim -Mrm 2> /dev/null
# при передаче скрипту параметра c, включаем агрессивный режим
if [ "$1" == "c" ]; then
@eignatov
eignatov / makeauthority.sh
Created January 26, 2016 13:47 — forked from sergeyklay/makeauthority.sh
Issue Your Own Self-Signed S/MIME Certs with OpenSSL
# Run this once
openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@eignatov
eignatov / install.sh
Created January 26, 2016 13:48 — forked from sergeyklay/install.sh
Install Nginx with Nchan
#!/usr/bin/env bash
# Works fine on Ubuntu 14.0.4 LTS
NGINX_VERSION="1.9.9"
NCHAN_VERSION="0.97"
HEADERS_MORE_VERSION="0.29"
DEV_KIT_VERSION="0.2.19"
ECHO_VERSION="0.58"
FANCY_INDEX_VERSION="0.3.5"
@eignatov
eignatov / scheduler.sh
Created January 26, 2016 13:49
Linux I/O Scheduler Test
#!/bin/sh
DISC="sda"; \
cat /sys/block/$DISC/queue/scheduler; \
for T in noop deadline cfq; do \
echo $T > /sys/block/$DISC/queue/scheduler; \
cat /sys/block/$DISC/queue/scheduler; \
sync && /sbin/hdparm -tT /dev/$DISC && echo "----"; \
sleep 15; \
done
@eignatov
eignatov / nginx.conf
Created January 26, 2016 13:51
Nginnx config for Yii 2 Advanced App Template (subdomains)
# frontend
server {
listen 80;
server_name yii2.lo;
server_tokens off;
client_max_body_size 128M;
charset utf-8;
access_log /var/log/nginx/yii2-access.log main buffer=50k;
@eignatov
eignatov / nginx.conf
Created January 26, 2016 14:08
My general Nginx config
# user http;
# user www-data;
worker_processes 4;
# [ debug | info | notice | warn | error | crit ]
error_log /var/log/nginx/error.log warn;
events {
worker_connections 1024;