View backlight.py
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() |
View filewatcher.py
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 |
View miralinks.py
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(): |
View gist:2838980
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 |
View saveimage.py
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 |
View templater.js
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]){ |
View gist:6619898
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)); |
View auto_clean_rpm.py
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 os | |
from collections import defaultdict | |
LIMIT = 1 | |
file_dict = defaultdict(list) | |
remove_files = [] | |
for filename in os.listdir('.'): | |
start = filename.split('-')[0] |
View totbox iptbles
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
/etc/iptables.rules | |
# Generated by iptables-save v1.4.14 on Thu Jun 5 19:52:31 2014 | |
*nat | |
:PREROUTING ACCEPT [0:0] | |
:INPUT ACCEPT [0:0] | |
:OUTPUT ACCEPT [0:0] | |
:POSTROUTING ACCEPT [0:0] | |
-A PREROUTING -i wlan0 -p udp --dport 53 -j REDIRECT --to-ports 53 | |
-A PREROUTING -i wlan0 -p tcp --syn -j REDIRECT --to-ports 9040 |
View gist:718e45841c4a081a38fd
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
#iptables -t nat -A PREROUTING -i br0 -p udp --dport 53 -j DNAT --to-destination 192.168.47.100:9053 | |
#iptables -t nat -A PREROUTING -i br0 -p tcp -m tcp -d ! 192.168.47.100 -j DNAT --to-destination 192.168.47.100:9040 | |
#iptables -t nat -A PREROUTING -i br1 -j DROP |
OlderNewer