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
## Frederik Braun, Jun 2011 | |
## Contact: <fb(AT)frederik-braun.com> | |
## Licence: WTFPL | |
## Python 2.7x | |
try: | |
import cPickle as pickle | |
except ImportError: | |
import pickle |
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
// checking integrity of JS files by freddyb | |
// using SHA256 by Chris Veness, licensed under LGPL | |
// but, to be honest, do whatever the heck you want | |
// it's not black magic, you know ;) | |
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ | |
/* SHA-256 implementation in JavaScript | (c) Chris Veness 2002-2010 | www.movable-type.co.uk */ | |
/* - see http://csrc.nist.gov/groups/ST/toolkit/secure_hashing.html */ | |
/* http://csrc.nist.gov/groups/ST/toolkit/examples.html */ |
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
function getSource(a){x=new XMLHttpRequest;x.open("GET",a,false);try{x.send()}catch(b){console.dir("Could not get JavaScript source due to some external JS references");alert("Code Integrity check failed")}sources.push(x.response.replace(/\s+/g,""));if(sources.length==document.scripts.length){computedHash=Sha256.hash(sources.join(""));console.dir("Hash of all JavaScript is "+computedHash);if(computedHash=="43958ba2baa4cc09552a52066cb13cd732141a4a920f6b4873c44f643ed1985b"){alert("Code Integrity verified")}else{alert("Warning, code integrity error. Do not trust this site with your code")}}}var Sha256={};Sha256.hash=function(a,b){b=typeof b=="undefined"?true:b;if(b)a=Utf8.encode(a);var c=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,11392 |
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 | |
import subprocess | |
def get_default_gw(): | |
''' returns ip address of default gateway as a string''' | |
res = subprocess.check_output(['route','-n']) | |
for line in res.split('\n'): | |
if line.startswith('0.0.0.0'): |
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 feedparser | |
import datetime | |
def main(urls, keywords): | |
keywords = map(lambda x: x.lower(), keywords) | |
for url in urls: | |
print "Starting to parse", url | |
feed = feedparser.parse(url) | |
for item in feed['items']: | |
title_text = item['title_detail']['value'] |
NewerOlder