Skip to content

Instantly share code, notes, and snippets.

@grimpy
grimpy / btmouse.py
Created April 14, 2012 21:09
Auto configuration for bluetooth mouse
#!/usr/bin/env python2
import bluetooth
import dbus
import dbus.mainloop.glib
import gobject
import sys
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
mainloop = gobject.MainLoop()
@grimpy
grimpy / xbmc.js
Last active August 29, 2015 14:01
AutoPebble XBMC Script
var title = "";
var labels = "";
var actions = "";
var windowid = "";
var moviequery = {'properties': ['title'],
'sort': {'order':'ascending',
'method': 'label'}
};
var XBMCHOST = global('XBMCHOST');
import github
import argparse
class Generator:
def __init__(self, token):
self.git = github.Github(token)
def generate(self, repo, milestone):
repo = self.git.get_repo(repo)
milestone = self.get_milestone(repo, milestone)
@grimpy
grimpy / ovcli
Last active November 28, 2018 10:50
zaccess script + readme
#!/usr/bin/env python3
import requests
from configparser import ConfigParser
import argparse
import os
import subprocess
import time
import base64
import json
import requests
import copy
import time
TOKENURL = 'https://api-my.te.eg/api/user/generatetoken?channelId=WEB_APP'
STATUSURL = 'https://api-my.te.eg/api/user/status'
LOGINURL = 'https://api-my.te.eg/api/user/login?channelId=WEB_APP'
DATAURL = 'https://api-my.te.eg/api/line/freeunitusage'
STATUSDATA = {
from js9 import j
GATEWAY_TEMPLATE_UID = 'github.com/zero-os/0-templates/gateway/0.0.1'
NODE_TEMPLATE_UID = 'github.com/zero-os/0-templates/node/0.0.1'
ZEROTIER_CLIENT_TEMPLATE_UID = 'github.com/zero-os/0-templates/zerotier_client/0.0.1'
cl = j.clients.zerotier.get()
zt_token = cl.config.data['token_']
iyo = j.clients.itsyouonline.get()
<?xml version="1.0" encoding="UTF-8"?>
<keymap>
<global>
<joystick name="NVIDIA Corporation NVIDIA Controller v01.03">
<a>Select</a> <!-- button a -->
<b>Back</b> <!-- button b -->
<back>ActivateWindow(Home)</back>
<start>ActivateWindow(PlayerControlls)</start>
<x>ContextMenu</x> <!-- button x -->
<y>ActivateWindow(Favourites)</y> <!-- button y -->
#!/usr/bin/env python3
from pyquery import PyQuery
from datetime import datetime
LIMITSELECTOR = ".QutaDetailsfixed > h3"
DAYSELECTOR = ".QutaDetailsfixed > h5"
TIMESELECTOR = ".QutaDetailsfixed > p"
def get_number(text):
from pywebostv.connection import WebOSClient
from pywebostv.controls import MediaControl, InputControl, SystemControl, SourceControl
class TV:
def __init__(self, ip, key=None):
self.store = {}
if key:
self.store['client_key'] = key
self.ip = ip
self.client = WebOSClient(ip)
#!/usr/bin/env python3
from http.server import SimpleHTTPRequestHandler, test, BaseHTTPRequestHandler
from functools import partial
from urllib.parse import quote
import socket
import subprocess
import sys
import os
class RequestHandler(SimpleHTTPRequestHandler):