Skip to content

Instantly share code, notes, and snippets.

@tuksik
tuksik / .muttrc-templ1
Last active September 13, 2015 10:54 — forked from zeta709/.muttrc
Mutt
# Mutt & Maildir Mini-HOWTO
# http://www.elho.net/mutt/maildir/
set mbox_type=Maildir
set folder="~/Maildir/"
set mask="!^\\.[^.]"
set record=".Sent"
set postponed=".Drafts"
set spoolfile="~/Maildir/"
mailboxes `echo -n "+ "; find ~/Maildir -maxdepth 1 -type d -name ".*" -printf "+'%f' "`
macro index c "<change-folder>?<toggle-mailboxes>" "open a different folder"
@tuksik
tuksik / .muttrc-gmail
Last active September 13, 2015 10:47 — forked from jaysonrowe/.muttrc
Mutt Configuration
# basic .muttrc for use with Gmail
# Change the following six lines to match your Gmail account details
set imap_user = "username@gmail.com"
set imap_pass = ""
set smtp_url = "smtp://username@smtp.gmail.com:587/"
set smtp_pass = ""
set from = "username@gmail.com"
set realname = "Firstname Lastname"
#
@tuksik
tuksik / cmd.py
Created September 13, 2015 09:34
# http://stackoverflow.com/questions/1378974/is-there-a-way-to-start-stop-linux-processes-with-python
# WARNING https://docs.python.org/2/library/subprocess.html#frequently-used-arguments
def CMD(cmd) :
p = subprocess.Popen(cmd, shell=True,
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=False)
return (p.stdin, p.stdout, p.stderr)
@tuksik
tuksik / is_apache_running.py
Last active September 13, 2015 06:35 — forked from miohtama/gist:4210349
Testing if Apache is running in certain local ports in Python
"""
Check if we have a local apache running and listening to certain ports.
"""
# http://pypi.python.org/pypi/psutil/
import psutil
@tuksik
tuksik / mysql_cold_backup.md
Last active August 31, 2015 14:08
Moving MySQL Cold Backup to Another DB Server
@tuksik
tuksik / user-data-script.sh
Last active August 30, 2015 12:29
Cloud-init example
#!/bin/sh
mkdir -p /var/lib/docker
mount -t ext4 /dev/xvdf1 /var/lib/docker -rw
@tuksik
tuksik / bind_log.md
Created August 28, 2015 15:09
Problem with /etc/ssl and BIND
Auto configuration failed
3077723872:error:0200100D:system library:fopen:Permission denied:bss_file.c:126:fopen('/usr/lib/ssl/openssl.cnf','rb')
3077723872:error:2006D002:BIO routines:BIO_new_file:system lib:bss_file.c:131:
3077723872:error:0E078002:configuration file routines:DEF_LOAD:system lib:conf_def.c:199:

###Solution: Restore working copy from /etc/ssl

#https://geekmush.wordpress.com/2007/06/29/how-to-make-fetchmail-happy-with-the-servers-ssl-cert/
openssl s_client -connect pop.gmail.com:995 -showcerts
@tuksik
tuksik / mail-command-line.sh
Last active August 29, 2015 14:27
send mails from command line
#http://www.binarytides.com/linux-mail-command-examples/
apt-get install mailutils
#Use
$ mail -s "Hello World" someone@example.com
Cc:
Hi Peter
How are you
I am fine
Good Bye
<Ctrl+D>
@tuksik
tuksik / boto_rsync.py
Created August 20, 2015 20:55
Backup to AWS EBS via Rsync and Boto
#!/usr/bin/env python
#http://www.takaitra.com/posts/384
import os
from boto.ec2.connection import EC2Connection
import time
IMAGE = 'ami-3275ee5b' # Basic 64-bit Amazon Linux AMI
KEY_NAME = 'takaitra-key'
INSTANCE_TYPE = 't1.micro'