Skip to content

Instantly share code, notes, and snippets.

Avatar
🐋

Pavel Zhovner zhovner

🐋
View GitHub Profile
View mailer.py
# Simple python mailer
# How to use: mailer('subject', 'mail@address', bodyvar)
from subprocess import *
def mailer(MailerSubject, RecipientAddress, MailBody):
readBody = Popen(["/bin/echo", MailBody], stdout=PIPE)
mail = Popen(["/usr/bin/mail", "-s", MailerSubject, RecipientAddress], stdin=readBody.stdout, stdout=PIPE)
output = mail.communicate()[0]
@zhovner
zhovner / whois-change.sh
Created Jun 22, 2013
Monitoring whois changes for one domain
View whois-change.sh
#!/bin/bash
#
# Run this script once per day
#
DOMAIN="ZHOVNER.COM"
if [ ! -f /tmp/$DOMAIN.old.whois.txt ]; then
View .profile
export LANG=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
if [ ! "$TMUX" ]; then
tmux attach
fi
@zhovner
zhovner / etckeeper.sh
Created Feb 5, 2013
etckeeper setup with bitbucket repo
View etckeeper.sh
# После установки etckeeper
/etc/etckeeper/etckeeper.conf VCS="git"
etckeeper init && etckeeper commit
# ------
git config --global user.name "My Machine"
git config --global user.email "etckeeper@my.machine"
@zhovner
zhovner / hdparm.sh
Created Feb 1, 2013
Disk write speed
View hdparm.sh
# test disk write speed
dd if=/dev/zero of=/tmp/output.img bs=8k count=256k
@zhovner
zhovner / netknife.py
Last active Dec 11, 2015
Python network
View netknife.py
# Validate IP address
import socket
def valid_ip(ipaddress):
try:
socket.inet_aton(ipaddress)
return True
except:
return False
@zhovner
zhovner / openssl.sh
Last active Dec 11, 2015
OpenSSL exampels
View openssl.sh
# Расшифровать ключ
openssl rsa –in enc.key -out dec.key
# Сравнить фингерпринты
openssl rsa -noout -modulus -in /rsa.key
openssl x509 -noout -modulus -in /crt.crt
# Вся инфа о сертификате
openssl x509 -in /cert.pem -noout -text
You can’t perform that action at this time.