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
PhantomJS Examples | |
================== | |
<script src="https://gist.github.com/3855613.js"></script> |
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 system = require('system'); | |
// Check argument count | |
if (system.args.length === 2) { | |
var url = system.args[1]; | |
} | |
else { | |
// Quit without correct arguments | |
console.log("URL Parameter Required."); | |
phantom.exit(); |
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 root_url = "http://www.mailinator.com/"; | |
// Create new WebPage object for browsing | |
var page = new WebPage(); | |
// Repeat console.log messages from PhantomJS | |
page.onConsoleMessage = function (msg) { | |
console.log(msg); | |
}; |
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
import pika | |
def callback(ch, method, properties, body): | |
pass | |
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost')) | |
channel = connection.channel() | |
channel.queue_declare(queue='queue', passive=True) | |
channel.basic_consume(callback, queue='queue', no_ack=False) | |
connection.close() |
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
import pika, json | |
# Clear the RMQ | |
def callback(ch, method, properties, body): | |
pass | |
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost')) | |
channel = connection.channel() | |
channel.queue_declare(queue='Phantom') | |
channel.basic_consume(callback, queue='Phantom', no_ack=True) |
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
8/24/11: | |
[21:23] <Jumpie> hah | |
[21:23] <Jumpie> obama is insane if he thinks he has a flying chance for reelection | |
8/29/12 | |
[15:02] <Jumpie> just that...obama wont win | |
[15:02] <+ReadError> he answered the most important question | |
[15:02] <Jumpie> romney isnt perfect, but he's the better choice | |
9/7/12 |
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
. | |
|-- Actor-Mixer Hierarchy | |
| |-- Character | |
| | `-- CharacterActions | |
| | |-- ContextSensitiveActions | |
| | | |-- Ammo_Supply | |
| | | | |-- AmmoBox_LidClose | |
| | | | |-- AmmoBox_LidOpen | |
| | | | |-- AmmoBox_Lift | |
| | | | |-- AmmoBox_Place |
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 HTMLParser import HTMLParser | |
import requests | |
import re | |
url_regex = "(https?:\/\/[^ ]+)" | |
class TitleParser(HTMLParser): | |
istitle = False |
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
[hpc72 ~]# nodetool info | |
Exception in thread "main" java.lang.AssertionError | |
at org.apache.cassandra.locator.TokenMetadata.getTokens(TokenMetadata.java:465) | |
at org.apache.cassandra.service.StorageService.getTokens(StorageService.java:2060) | |
at org.apache.cassandra.service.StorageService.getTokens(StorageService.java:2049) | |
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | |
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) | |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | |
at java.lang.reflect.Method.invoke(Method.java:606) | |
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:75) |
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 get_logger(): | |
handler = logging.StreamHandler() | |
handler.setFormatter(logging.Formatter("[%(asctime)s] [%(levelname)s] %(message)s")) | |
logger = logging.getLogger("distribute") | |
logger.addHandler(handler) | |
logger.setLevel(10) | |
return logger | |
logger = get_logger() |