This file contains 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
<html> | |
<head> | |
<script src="http://www.sucs.org/~jonhurlock/assets/js/jquery-latest.js"></script> | |
<style> | |
#menulist li {float: left; list-style: none; padding-left: 1em;} | |
</style> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
This file contains 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 | |
""" | |
Simple Indexer | |
================================= | |
Author: Jon Hurlock, October 2011 | |
This script basically crawls a domain (not just a page) and | |
then extracts all links <a href=""></a>, and finds all links | |
on that domain it also is able extract different file types |
This file contains 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
<html> | |
<head> | |
<title>PHP Reading from a file</title> | |
</head> | |
<body> | |
<h1>Output</h1> | |
<?php | |
// start of php code, | |
// @author Jon Hurlock (http://cs.swan.ac.uk/~csjonhurlock/) |
This file contains 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
############# My Clusters Health | |
curl -XGET 'http://127.0.0.1:9200/_cluster/health?pretty=true' | |
{ | |
"cluster_name" : "TweetHadoop", | |
"status" : "yellow", | |
"timed_out" : false, | |
"number_of_nodes" : 1, | |
"number_of_data_nodes" : 1, | |
"active_primary_shards" : 15, |
This file contains 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 reverse_sentence_order(forward_sentence): | |
backwards_sentence = "" | |
words_in_stack = forward_sentence.split(" ") | |
for x in range(0,len(words_in_stack)): | |
backwards_sentence = backwards_sentence+" "+ words_in_stack.pop() | |
return backwards_sentence[1:] | |
""" | |
Code Breakdown | |
-------------- |
This file contains 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 collections | |
def first_unique(some_list): | |
dict_of_items = collections.OrderedDict() | |
for item in some_list: | |
if item in dict_of_items: | |
dict_of_items[item] +=1 | |
else: | |
dict_of_items[item] = 1 | |
for key in dict_of_items: |
This file contains 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
""" | |
Imagine you have a stream of data. | |
As long as the stream keeps streaming you must keep reading the data. | |
You can only read in x bytes of data at a time. | |
You must count all occurances of a search term y in the stream until | |
the stream stops. | |
Edge cases: | |
search term is empty |