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
| """ HULK DB - A BIG DUMB DATA STORE | |
| A probably overly simple way to store data to disk | |
| with fast writes and lookups without needing indices in RAM | |
| TODO: RESTful interface (something lightweight cherry-py maybe) | |
| MAYBE: expirations | |
| NEVER: Clustering, complex storage, data-types | |
| """ |
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
| class WordLimit { | |
| public static void main(String args[]) { | |
| assert(limit("cat dog", 3) == "cat"); | |
| assert(limit("cat", 3) == "cat"); | |
| assert(limit("cat ", 4) == "cat"); | |
| assert(limit("cat dog", 5) == "cat"); | |
| assert(limit("cat dog bird", 10) == "cat dog"); | |
| assert(limit("cat", 9) == "cat"); |
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 limit(s, max): | |
| """ Limit string s to x characters respecting space boundaries | |
| >>> limit('cat dog', 3); | |
| 'cat' | |
| >>> limit('cat', 3); | |
| 'cat' | |
| >>> limit('cat ', 4); | |
| 'cat' | |
| >>> limit('cat dog', 5); |
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 conv(ts): | |
| results = Set([]) | |
| parts = ts.split(",") | |
| for part in parts: | |
| if "-" not in part: | |
| results.add(int(part.strip())) | |
| else: | |
| (s, e) = part.split("-") | |
| for i in range(int(s.strip()), int(e.strip()) + 1): | |
| results.add(i) |
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 grequests | |
| import redis | |
| import time | |
| BATCH_SIZE = 10 | |
| THRESHOLD = 3 | |
| SLEEP_TIME = 60 | |
| # MANIFEST -[(URL, Check type, check value), ...] | |
| sites = [ |
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 sys | |
| path = sys.argv[1] | |
| ext = 'txt' | |
| dir = 'output' | |
| limit = 10000 | |
| limits = {} | |
| with open(path) as file: |
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
| # ====================== | |
| # Naive search | |
| # ====================== | |
| import time | |
| import random | |
| input = 'https://www.facebook.com/teefury?hc_location=stream' | |
| bids = [] |
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
| <?php | |
| /** | |
| * Database Base Model class | |
| */ | |
| class Model { | |
| // Hold raw properties for save() which take precedence over regular properties | |
| // used in combination with set_raw() as in set_raw('somefield', 'CURDATE()') | |
| // Will allow you to pass in raw SQL, so use with caution |
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/perl | |
| use strict; | |
| my $line; | |
| my $i=1; | |
| if($#ARGV == 2){ | |
| open (IN, "<$ARGV[0]") or die "Can't open $ARGV[0]"; | |
| while ($line = <IN>) { | |
| if($ARGV[1] <= $i && $i <= $ARGV[2]){ |
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
| <? | |
| $rawpost = file_get_contents("php://input"); | |
| print '$_GET'."\n"; | |
| print_r($_GET); | |
| print str_repeat("=",30)."\n"; | |
| print '$_POST'."\n"; | |
| print_r($_POST); | |
| print str_repeat("=",30)."\n"; | |
| print 'RAW POST'."\n"; | |
| print_r($rawpost); |