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
| stage { "pre": before => Stage["main"] } | |
| class python { | |
| package { | |
| "build-essential": ensure => latest; | |
| "python": ensure => "2.6.6-2ubuntu1"; | |
| "python-dev": ensure => "2.6.6-2ubuntu1"; | |
| "python-setuptools": ensure => "latest"; | |
| } | |
| exec { "easy_install pip": | |
| path => "/usr/local/bin:/usr/bin:/bin", |
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
| var http = require("http"), | |
| url = require("url"), | |
| path = require("path"), | |
| fs = require("fs") | |
| port = process.argv[2] || 8888; | |
| http.createServer(function(request, response) { | |
| var uri = url.parse(request.url).pathname | |
| , filename = path.join(process.cwd(), uri); |
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 | |
| """ | |
| @date 11/18/10 | |
| @author Paul Hubbard | |
| @brief Code up BrianF's twisted thought experiment | |
| @note Must use 'limit descriptors 512' to run this! | |
| ======================================================================= | |
| @inlinecallbacks |
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
| #!/bin/sh | |
| # ------------------------------------------------------------------------------ | |
| # SOME INFOS : fairly standard (debian) init script. | |
| # Note that node doesn't create a PID file (hence --make-pidfile) | |
| # has to be run in the background (hence --background) | |
| # and NOT as root (hence --chuid) | |
| # | |
| # MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit | |
| # INIT-INFO RULES http://wiki.debian.org/LSBInitScripts | |
| # INSTALL/REMOVE http://www.debian-administration.org/articles/28 |
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 __future__ import with_statement | |
| from fabric.api import env, run, settings, hide | |
| from fabric.decorators import hosts, runs_once | |
| venv = "/home/websites/.virtualenvs/twtv3/" | |
| env.user = 'webdev' | |
| env.hosts = [ | |
| '192.168.1.10', | |
| '192.168.1.11', |
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 | |
| # encoding: utf-8 | |
| # | |
| # Requires statlib http://code.google.com/p/python-statlib/ | |
| """ | |
| process_tornado_bm.py | |
| Created by Jacob Kristhammar on 2010-12-09. | |
| """ |
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
| # -*- coding:utf-8 -*- | |
| import re | |
| import urllib2 | |
| from lib.BeautifulSoup import BeautifulSoup | |
| agent="""Sosospider+(+http://help.soso.com/webspider.htm)""" | |
| blog_url = 'http://blog.sina.com.cn/s/articlelist_1517582220_0_1.html' | |
| spider_handle = urllib2.urlopen(blog_url) | |
| blog_content = spider_handle.read() |
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
| worker_processes 2; | |
| error_log /var/log/nginx/error.log; | |
| pid /var/run/nginx.pid; | |
| events { | |
| worker_connections 1024; | |
| use epoll; | |
| } |
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 new_user(admin_username, admin_password): | |
| env.user = 'root' | |
| # Create the admin group and add it to the sudoers file | |
| admin_group = 'admin' | |
| runcmd('addgroup {group}'.format(group=admin_group)) | |
| runcmd('echo "%{group} ALL=(ALL) ALL" >> /etc/sudoers'.format( | |
| group=admin_group)) | |
| # Create the new admin user (default group=username); add to admin group |
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
| """ | |
| usage: | |
| fab -f distkeys.py set_hosts:/path/to/hosts_file add_key:/path/to/key | |
| Use --password and --user options as necessary | |
| Inspired by shell script at http://github.com/mlbright/mybin/raw/master/distkeys.sh | |
| Fabric recipe to distribute your ssh key to large number of hosts. |