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 | |
# 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 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 subprocess | |
def getClipboardData(): | |
p = subprocess.Popen(['pbpaste'], stdout=subprocess.PIPE) | |
retcode = p.wait() | |
data = p.stdout.read() | |
return data | |
def setClipboardData(data): | |
p = subprocess.Popen(['pbcopy'], stdin=subprocess.PIPE) |
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 current_dir(): | |
# returns a unix current directory | |
# By: Cody Kochmann | |
from os import path | |
return(path.dirname(path.realpath(__file__))) |
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 | |
# 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 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
gen_fingerprint = -> | |
# in reference to: http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript | |
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace /[xy]/g, (c) -> | |
r = Math.random() * 16 | 0 | |
v = if c == 'x' then r else r & 0x3 | 0x8 | |
v.toString 16 |
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
load_style=(css)-> | |
l = document.createElement('style') | |
l.innerHTML = css | |
l.type = 'text/css' | |
document.getElementsByTagName('head')[0].appendChild(l) | |
return | |
load_css=(url)-> | |
l = document.createElement('link') | |
l.src = url |
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 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"); |
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 remove_spaces(s){ | |
// removes spaces from a string | |
// by: Cody Kochmann | |
return(s.split(" ").join("")); | |
} |
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
class b64 | |
constructor:()->@ | |
e:(a)-> window.btoa unescape(encodeURIComponent(a)) | |
d:(a)-> decodeURIComponent escape(window.atob(a)) | |
eval:(a)-> eval decodeURIComponent(escape(window.atob(a))) | |
b64 = new b64 |
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
var generate_active_width = function(dom_id,min_inches,flexing_percentage,max_inches){ | |
// pre-renders media specific rules for a div in order to keep it a constant width without needing to | |
// worry about the stability of "margin:0 auto" in certain situations. | |
// by: Cody Kochmann | |
var inject_css = function(a) { | |
var b = document.createElement("style"); | |
b.innerHTML = a; | |
b.type = "text/css"; | |
document.getElementsByTagName("head")[0].appendChild(b) | |
} |