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
$.ajaxSetup({ | |
beforeSend: function(xhr, settings) { | |
function getCookie(name) { | |
var cookieValue = null; | |
if (document.cookie && document.cookie != '') { | |
var cookies = document.cookie.split(';'); | |
for (var i = 0; i < cookies.length; i++) { | |
var cookie = jQuery.trim(cookies[i]); | |
if (cookie.substring(0, name.length + 1) == (name + '=')) { | |
cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); |
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 render(template, kwargs){ | |
this.template = template | |
this.kwargs = kwargs | |
this.render_str = function(temp, kwargs){ | |
re = /{{(.*?)}}/g | |
if(kwargs == undefined){kwargs=this.kwargs} | |
return temp.replace(re, function(a,b){ | |
clean_key = b.trim(); | |
if(kwargs[clean_key]){ |
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 python2 | |
#coding: utf-8 | |
import gevent.monkey | |
gevent.monkey.patch_socket() | |
import sys | |
import os | |
from urlparse import urlparse | |
import urllib |
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
all = '0123456789abcdefghijklmnopqrstuvwxyz' | |
l=len(all) | |
t=8248398492887 | |
r=list() | |
while True: | |
p,t=t%l,t//l | |
r.append(p) | |
if t<l: | |
r.append(t) if t is not 0 else None | |
break |
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
#coding: utf-8 | |
from grab import Grab | |
from BeautifulSoup import BeautifulSoup | |
import re | |
import datetime as dt | |
class miralinksapi(): |
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
#coding: utf-8 | |
import pyinotify | |
import os | |
class action(pyinotify.ProcessEvent): | |
def process_IN_MODIFY(self, event): | |
l = open(os.path.join(event.path, event.name)).readlines()[-1] | |
#print os.path.join(event.path, event.name), l |
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 sys | |
import os | |
class backlight(): | |
def __init__(self, cmd): | |
self.path = "echo '%s' > /sys/class/backlight/samsung/brightness" | |
self.limit_down, self.limit_up = 1, 7 | |
self.current = int(os.popen("cat /sys/class/backlight/samsung/brightness").read().strip()) | |
self.cmd = cmd.strip() | |
self.setbacklight() |
NewerOlder