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 extract_links(url): | |
# extracts all links from a URL and returns them as a list | |
# by: Cody Kochmann | |
def grep(link): | |
from urllib2 import urlopen | |
response = urlopen(link) | |
return(response.read()) | |
def check_if_link(s,req_http=True): | |
# Checks at the input is a legitimate link. |
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 split_all_strings(input_array, splitter): | |
# splits all strings in a list with the splitter and adds them back | |
# by: Cody Kochmann | |
if isinstance(input_array, basestring): | |
# patch to accept input_array in string form | |
input_array = [input_array] | |
result = [] | |
for i in input_array: | |
for x in i.split(split_char): | |
result.append(x) |
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
curl = (theUrl) -> | |
xmlHttp = null | |
xmlHttp = new XMLHttpRequest | |
xmlHttp.open 'GET', theUrl, false | |
xmlHttp.send null | |
xmlHttp.responseText | |
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
(function() { | |
// covers the screen with a touch interphase that can be used to delete | |
// elements in the way. This is purposed to be a manual type of adblock | |
// author: Cody Kochmann | |
var div = document.createElement("div"); | |
div.id = 'page_cleaner544'; | |
div.innerHTML = "<div id='click_remover' style='width:" + window.outerWidth.toString() + "px; height:" + window.outerHeight.toString() + "px; background : rgba(50,50,50,0.1); position:fixed; z-index:2147483646; top:0; left:0;'></div>"; | |
div.innerHTML += "<style>#close_cleaner{position:fixed;height:auto;padding:0.15in 0;width:2in;bottom:0.5in;left:0.5in;background:rgba(250,250,250,0.85);-webkit-touch-callout: none;-webkit-user-select: none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;color:rgba(50,50,50,0.65);text-align:center;z-index:2147483647;}</style><p id='close_cleaner'>Done</p>"; | |
document.body.appendChild(div); | |
var click_remover = document.getElementById('click_remover'); |
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 | |
# shell script that uses cpulimit to slow down a selfish app | |
import os, sys, time | |
if "-stop" in " ".join(sys.argv): | |
print "stopping all limiters." | |
os.system('killall cpulimit') | |
target_app = raw_input("What app would you like to limit?\n") |
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 check_if_link(s,req_http=True): | |
# Checks if the input is a link. | |
allowed_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~:/?#[]@!$&'()*+,;=%" | |
if req_http and "http" not in s: | |
return(False) | |
if "://" in s: | |
for i in s: | |
if i not in allowed_chars: | |
return(False) | |
return(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
#!/usr/bin/env python | |
# shell script to collect the links visited on Google Chrome | |
# by: Cody Kochmann | |
import os, time | |
def current_links(): | |
try: | |
chrome_link=os.popen("""osascript -e 'tell application "Google Chrome" to return URL of active tab of front window'""").read().split("\n")[0] | |
return chrome_link |
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 | |
# shell script for getting stats on the primary disk | |
# example data available = ['/dev/disk0s2', '328Gi', '315Gi', '13Gi', '97%', '82518570', '3418928', '96%', '/\n'] | |
import os | |
disk = os.popen("df -h | grep '/dev/disk0s2'").read().split(' ') | |
for i in list(disk): | |
if len(i) is 0: |
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
function myIP() { | |
// returns the users ip address | |
// ref link: http://stackoverflow.com/questions/391979/get-client-ip-using-just-javascript | |
if (window.XMLHttpRequest) xmlhttp = new XMLHttpRequest(); | |
else xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); | |
xmlhttp.open("GET","http://api.hostip.info/get_html.php",false); | |
xmlhttp.send(); | |
hostipInfo = xmlhttp.responseText.split("\n"); |
NewerOlder