This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fabric.api import env, run | |
import time | |
env.hosts = ['web01-east'] | |
def logtime(method): | |
def timed(*args, **kw): | |
ts = time.time() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from termcolor import colored | |
import requests | |
import time | |
while True: | |
ltc = requests.get("https://btc-e.com/api/2/ltc_usd/ticker").json() | |
btc = requests.get("https://btc-e.com/api/2/btc_usd/ticker").json() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# | |
# usage: ./check-spf.py domain.com | |
# | |
# author: [email protected] | |
# | |
# | |
import sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@photoblogcom named]# dig +trace test1.photoblog.com | |
; <<>> DiG 9.3.6-P1-RedHat-9.3.6-20.P1.el5_8.6 <<>> +trace test1.photoblog.com | |
;; global options: printcmd | |
. 44083 IN NS d.root-servers.net. | |
. 44083 IN NS e.root-servers.net. | |
. 44083 IN NS f.root-servers.net. | |
. 44083 IN NS g.root-servers.net. | |
. 44083 IN NS h.root-servers.net. | |
. 44083 IN NS i.root-servers.net. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fabric.api import * | |
@task | |
@runs_once | |
def prod(): | |
env.roledefs['app'] = ['web1.sc', 'web2.sc', 'web3.sc', 'web4.sc'] | |
env.roledefs['lb'] = ['lb1.sc', 'lb2.sc'] | |
env.roledefs['sql'] = ['mysql1.sc', 'mysql2.sc'] | |
@task |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PYTHONPATH=/opt/graphite/webapp/graphite | |
MODULE=graphite_uwsgi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The following part is optional! It just compiles and installs the chosen | |
# global ruby version to help on bootstrapping. To achieve this, it uses | |
# "ruby-build" utility. | |
define rbenv::compile($user,$global_ruby="1.9.2-p290",$bundler_version='1.1.3') { | |
# STEP 1 | |
exec { "checkout rbenv for ${user}": | |
command => "git clone git://github.com/sstephenson/rbenv.git .rbenv", | |
user => $user, | |
cwd => "/home/${user}", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
from subprocess import Popen, PIPE, STDOUT | |
try: | |
search = sys.argv[1] | |
except: | |
print "Need to enter a email or a part of an email" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import urllib2 | |
import base64 | |
import sys | |
import optparse | |
from xml.dom.minidom import parseString | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def local_sed(filename, before, after, limit='', use_sudo=False, backup=''): | |
""" | |
Run a search-and-replace on ``filename`` with given regex patterns. | |
Equivalent to ``sed -i<backup> -r -e "/<limit>/ s/<before>/<after>/g | |
<filename>"``. | |
For convenience, ``before`` and ``after`` will automatically escape forward | |
slashes, single quotes and parentheses for you, so you don't need to | |
specify e.g. ``http:\/\/foo\.com``, instead just using ``http://foo\.com`` |